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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-12-06 13:55:30 +0300
committerTon Roosendaal <ton@blender.org>2005-12-06 13:55:30 +0300
commitd024452ebf97c0926b1601371d2ee802bd754f3c (patch)
treeb6afebbe0b0cb682062bed92acbf33fe33b09aae /source/blender
parent863234481e751ae94dd77b18d65ea76df65ec4b1 (diff)
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive NLA option in groups... so, cleaned up the old code (removed most) and integrated it back in a more useful way. Usage: - CTRL+G gives menu to add group, add to existing group, or remove from groups. - In Object buttons, a new (should become first) Panel was added, showing not only Object "ID button" and Parent, but also the Groups the Object Belongs to. These buttons also allow rename, assigning or removing. - To indicate Objects are grouped, they're drawn in a (not theme yet, so temporal?) green wire color. - Use ALT+SHIFT mouse-select to (de)select an entire group But, the real power of groups is in the following features: -> Particle Force field and Guide control In the "Particle Motion" Panel, you can indicate a Group name, this then limits force fields or guides to members of that Group. (Note that layers still work on top of that... not sure about that). -> Light Groups In the Material "Shaders" Panel, you can indicate a Group name to limit lighting for the Material to lamps in this group. The Lights in a Group do need to be 'visible' for the Scene to be rendered (as usual). -> Group Duplicator In the Object "Anim" Panel, you can set any Object (use Empty!) to duplicate an entire Group. It will make copies of all Objects in that Group. Also works for animated Objects, but it will copy the current positions or deforms. Control over 'local timing' (so we can do Massive anims!) will be added later. (Note; this commit won't render Group duplicators yet, a fix in bf-blender will enable that, next commit will sync) -> Library Appending In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed. By appending or linking the Group itself, and use the Group Duplicator, you now can animate and position linked Objects. The nice thing is that the local saved file itself will only store the Group name that was linked, so on a next file read, the Group Objects will be re-read as stored (changed) in the Library file. (Note; current implementation also "gives a base" to linked Group Objects, to show them as Objects in the current Scene. Need that now for testing purposes, but probably will be removed later). -> Outliner Outliner now shows Groups as optio too, nice to organize your data a bit too! In General, Groups have a very good potential... for example, it could become default for MetaBall Objects too (jiri, I can help you later on how this works). All current 'layer relationships' in Blender should be dropped in time, I guess...
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_anim.h3
-rw-r--r--source/blender/blenkernel/BKE_effect.h6
-rw-r--r--source/blender/blenkernel/BKE_group.h12
-rw-r--r--source/blender/blenkernel/BKE_scene.h2
-rw-r--r--source/blender/blenkernel/bad_level_call_stubs/stubs.c1
-rw-r--r--source/blender/blenkernel/intern/anim.c47
-rw-r--r--source/blender/blenkernel/intern/effect.c85
-rw-r--r--source/blender/blenkernel/intern/group.c229
-rw-r--r--source/blender/blenkernel/intern/scene.c6
-rw-r--r--source/blender/blenkernel/intern/softbody.c2
-rw-r--r--source/blender/blenloader/intern/readblenentry.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c55
-rw-r--r--source/blender/blenloader/intern/writefile.c18
-rw-r--r--source/blender/include/BIF_editgroup.h10
-rw-r--r--source/blender/include/BIF_resources.h4
-rw-r--r--source/blender/include/BIF_space.h3
-rw-r--r--source/blender/include/butspace.h11
-rw-r--r--source/blender/makesdna/DNA_effect_types.h3
-rw-r--r--source/blender/makesdna/DNA_group_types.h45
-rw-r--r--source/blender/makesdna/DNA_material_types.h2
-rw-r--r--source/blender/makesdna/DNA_object_types.h9
-rw-r--r--source/blender/makesdna/DNA_scene_types.h1
-rw-r--r--source/blender/makesdna/DNA_space_types.h1
-rw-r--r--source/blender/render/extern/include/render_types.h1
-rw-r--r--source/blender/render/intern/source/envmap.c7
-rw-r--r--source/blender/render/intern/source/initrender.c29
-rw-r--r--source/blender/render/intern/source/pixelshading.c9
-rw-r--r--source/blender/render/intern/source/renderPreAndPost.c9
-rw-r--r--source/blender/render/intern/source/rendercore.c35
-rw-r--r--source/blender/renderconverter/intern/convertBlenderScene.c78
-rw-r--r--source/blender/src/butspace.c30
-rw-r--r--source/blender/src/buttons_object.c381
-rw-r--r--source/blender/src/buttons_shading.c2
-rw-r--r--source/blender/src/drawobject.c14
-rw-r--r--source/blender/src/drawview.c1
-rw-r--r--source/blender/src/editgroup.c115
-rw-r--r--source/blender/src/editipo.c9
-rw-r--r--source/blender/src/editobject.c12
-rw-r--r--source/blender/src/editview.c35
-rw-r--r--source/blender/src/filesel.c39
-rw-r--r--source/blender/src/header_oops.c20
-rw-r--r--source/blender/src/header_view3d.c2
-rw-r--r--source/blender/src/outliner.c36
-rw-r--r--source/blender/src/previewrender.c14
-rw-r--r--source/blender/src/space.c53
45 files changed, 695 insertions, 793 deletions
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index 16e8b5652aa..e4cd8e39aca 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -43,9 +43,6 @@ void free_path(struct Path *path);
void calc_curvepath(struct Object *ob);
int interval_test(int min, int max, int p1, int cycl);
int where_on_path(struct Object *ob, float ctime, float *vec, float *dir);
-void frames_duplilist(struct Object *ob);
-void vertex_duplilist(struct Scene *sce, struct Object *par);
-void particle_duplilist(struct Scene *sce, struct Object *par, struct PartEff *paf);
void free_duplilist(void);
void make_duplilist(struct Scene *sce, struct Object *ob);
int count_duplilist(struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index c68d4b8b10e..d149d2b6e7c 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -38,10 +38,8 @@ struct Effect;
struct ListBase;
struct Object;
struct PartEff;
-struct MTex;
-struct Mesh;
-struct WaveEff;
struct Particle;
+struct Group;
struct Effect *add_effect(int type);
void free_effect(struct Effect *eff);
@@ -57,7 +55,7 @@ void build_particle_system(struct Object *ob);
/* particle deflector */
#define PE_WIND_AS_SPEED 0x00000001
-struct ListBase *pdInitEffectors(struct Object *ob);
+struct ListBase *pdInitEffectors(struct Object *obsrc, struct Group *group);
void pdEndEffectors(struct ListBase *lb);
void pdDoEffectors(struct ListBase *lb, float *opco, float *force, float *speed, float cur_time, float loc_time, unsigned int flags);
diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h
index 265d16579c2..4e69f18a238 100644
--- a/source/blender/blenkernel/BKE_group.h
+++ b/source/blender/blenkernel/BKE_group.h
@@ -35,26 +35,16 @@
#define BKE_GROUP_H
struct Group;
-struct GroupKey;
struct GroupObject;
-struct ObjectKey;
struct Object;
-void free_object_key(struct ObjectKey *ok);
void free_group_object(struct GroupObject *go);
void free_group(struct Group *group);
struct Group *add_group(void);
-void object_to_obkey(struct Object *ob, struct ObjectKey *ok);
-void obkey_to_object(struct ObjectKey *ok, struct Object *ob);
-void add_object_key(struct GroupObject *go, struct GroupKey *gk);
void add_to_group(struct Group *group, struct Object *ob);
void rem_from_group(struct Group *group, struct Object *ob);
-void add_group_key(struct Group *group);
-void set_object_key(struct Object *ob, struct ObjectKey *ok);
-void set_group_key(struct Group *group);
struct Group *find_group(struct Object *ob);
-void set_group_key_name(struct Group *group, char *name);
-void set_group_key_frame(struct Group *group, float frame);
+int object_in_group(struct Object *ob, struct Group *group);
#endif
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 1313ad251e7..a7eea6f6393 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -60,7 +60,7 @@ void free_qtcodecdata(struct QuicktimeCodecData *acd);
void free_scene(struct Scene *me);
struct Scene *add_scene(char *name);
-int object_in_scene(struct Object *ob, struct Scene *sce);
+struct Base *object_in_scene(struct Object *ob, struct Scene *sce);
void set_scene_bg(struct Scene *sce);
void set_scene_name(char *name);
diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c
index 98ecc32ee3f..44997480779 100644
--- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c
+++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c
@@ -211,6 +211,7 @@ void externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg,
void RE_free_envmap(struct EnvMap *env){}
struct EnvMap *RE_copy_envmap(struct EnvMap *env){ return env;}
void RE_free_envmapdata(struct EnvMap *env){}
+void init_render_textures(void){}
int RE_envmaptex(struct Tex *tex, float *texvec, float *dxt, float *dyt){
return 0;
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index b8178dd98cd..b448816589f 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -40,14 +40,15 @@
#include "BLI_arithb.h"
#include "DNA_listBase.h"
-#include "DNA_object_types.h"
#include "DNA_curve_types.h"
-#include "DNA_key_types.h"
-#include "DNA_view3d_types.h"
#include "DNA_effect_types.h"
+#include "DNA_group_types.h"
+#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_view3d_types.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
@@ -271,7 +272,7 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* returns OK
return 1;
}
-static Object *new_dupli_object(ListBase *lb, Object *ob, Object *par)
+static Object *new_dupli_object(ListBase *lb, Object *ob, Object *par, int clearpar)
{
Object *newob;
@@ -284,7 +285,7 @@ static Object *new_dupli_object(ListBase *lb, Object *ob, Object *par)
/* only basis-ball gets displist */
if(newob->type==OB_MBALL) newob->disp.first= newob->disp.last= NULL;
- if(ob!=par) { // dupliverts, particle
+ if(clearpar) { // dupliverts, particle
newob->parent= NULL;
newob->track= NULL;
}
@@ -293,7 +294,22 @@ static Object *new_dupli_object(ListBase *lb, Object *ob, Object *par)
return newob;
}
-void frames_duplilist(Object *ob)
+static void group_duplilist(Object *ob)
+{
+ Object *newob;
+ GroupObject *go;
+ float mat[4][4];
+
+ if(ob->dup_group==NULL) return;
+
+ for(go= ob->dup_group->gobject.first; go; go= go->next) {
+ newob= new_dupli_object(&duplilist, go->ob, ob, 0);
+ Mat4CpyMat4(mat, newob->obmat);
+ Mat4MulMat4(newob->obmat, mat, ob->obmat);
+ }
+}
+
+static void frames_duplilist(Object *ob)
{
extern int enable_cu_speed; /* object.c */
Object *newob, copyob;
@@ -315,7 +331,7 @@ void frames_duplilist(Object *ob)
else ok= 0;
}
if(ok) {
- newob= new_dupli_object(&duplilist, ob, ob);
+ newob= new_dupli_object(&duplilist, ob, ob, 0);
do_ob_ipo(newob);
where_is_object_time(newob, (float)G.scene->r.cfra);
@@ -343,7 +359,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
VecSubf(vec, vec, vdd->pmat[3]);
VecAddf(vec, vec, vdd->ob->obmat[3]);
- newob= new_dupli_object(&duplilist, vdd->ob, vdd->par);
+ newob= new_dupli_object(&duplilist, vdd->ob, vdd->par, 1);
VECCOPY(newob->obmat[3], vec);
if(vdd->par->transflag & OB_DUPLIROT) {
@@ -359,7 +375,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
}
-void vertex_duplilist(Scene *sce, Object *par)
+static void vertex_duplilist(Scene *sce, Object *par)
{
Object *ob;
Base *base;
@@ -420,8 +436,7 @@ void vertex_duplilist(Scene *sce, Object *par)
dm->release(dm);
}
-
-void particle_duplilist(Scene *sce, Object *par, PartEff *paf)
+static void particle_duplilist(Scene *sce, Object *par, PartEff *paf)
{
Object *ob, *newob;
Base *base;
@@ -462,7 +477,7 @@ void particle_duplilist(Scene *sce, Object *par, PartEff *paf)
mtime= pa->time+pa->lifetime;
for(ctime= pa->time; ctime<mtime; ctime+=paf->staticstep) {
- newob= new_dupli_object(&duplilist, ob, par);
+ newob= new_dupli_object(&duplilist, ob, par, 1);
/* make sure hair grows until the end.. */
if(ctime>pa->time+pa->lifetime) ctime= pa->time+pa->lifetime;
@@ -494,7 +509,7 @@ void particle_duplilist(Scene *sce, Object *par, PartEff *paf)
if((paf->flag & PAF_DIED)==0 && ctime > pa->time+pa->lifetime) continue;
//if(ctime < pa->time+pa->lifetime) {
- newob= new_dupli_object(&duplilist, ob, par);
+ newob= new_dupli_object(&duplilist, ob, par, 1);
/* to give ipos in object correct offset */
where_is_object_time(newob, ctime-pa->time);
@@ -523,7 +538,6 @@ void particle_duplilist(Scene *sce, Object *par, PartEff *paf)
}
}
-
void free_duplilist()
{
Object *ob;
@@ -551,7 +565,10 @@ void make_duplilist(Scene *sce, Object *ob)
font_duplilist(ob);
}
}
- else if(ob->transflag & OB_DUPLIFRAMES) frames_duplilist(ob);
+ else if(ob->transflag & OB_DUPLIFRAMES)
+ frames_duplilist(ob);
+ else if(ob->transflag & OB_DUPLIGROUP)
+ group_duplilist(ob);
}
}
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index b2b52cfda06..e2582c5d86c 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -36,19 +36,21 @@
#include <stdlib.h>
#include "MEM_guardedalloc.h"
-#include "DNA_listBase.h"
+
+#include "DNA_curve_types.h"
#include "DNA_effect_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
+#include "DNA_group_types.h"
+#include "DNA_ipo_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_listBase.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_material_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_key_types.h"
+#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_texture_types.h"
#include "DNA_scene_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_ipo_types.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -326,42 +328,57 @@ typedef struct pEffectorCache {
Object obcopy; /* for restoring transformation data */
} pEffectorCache;
+static void add_to_effectorcache(ListBase *lb, Object *ob, Object *obsrc)
+{
+ pEffectorCache *ec;
+ PartDeflect *pd= ob->pd;
+
+ if(pd->forcefield == PFIELD_GUIDE) {
+ if(ob->type==OB_CURVE && obsrc->type==OB_MESH) { /* guides only do mesh particles */
+ Curve *cu= ob->data;
+ if(cu->flag & CU_PATH) {
+ if(cu->path==NULL || cu->path->data==NULL)
+ makeDispListCurveTypes(ob, 0);
+ if(cu->path && cu->path->data) {
+ ec= MEM_callocN(sizeof(pEffectorCache), "effector cache");
+ ec->ob= ob;
+ BLI_addtail(lb, ec);
+ }
+ }
+ }
+ }
+ else if(pd->forcefield) {
+ ec= MEM_callocN(sizeof(pEffectorCache), "effector cache");
+ ec->ob= ob;
+ BLI_addtail(lb, ec);
+ }
+}
/* returns ListBase handle with objects taking part in the effecting */
-ListBase *pdInitEffectors(Object *obsrc)
+ListBase *pdInitEffectors(Object *obsrc, Group *group)
{
static ListBase listb={NULL, NULL};
pEffectorCache *ec;
- unsigned int layer= obsrc->lay;
Base *base;
-
- for(base = G.scene->base.first; base; base= base->next) {
- if( (base->lay & layer) && base->object->pd && base->object!=obsrc) {
- Object *ob= base->object;
- PartDeflect *pd= ob->pd;
-
- if(pd->forcefield == PFIELD_GUIDE) {
- if(ob->type==OB_CURVE && obsrc->type==OB_MESH) { /* guides only do mesh particles */
- Curve *cu= ob->data;
- if(cu->flag & CU_PATH) {
- if(cu->path==NULL || cu->path->data==NULL)
- makeDispListCurveTypes(ob, 0);
- if(cu->path && cu->path->data) {
- ec= MEM_callocN(sizeof(pEffectorCache), "effector cache");
- ec->ob= ob;
- BLI_addtail(&listb, ec);
- }
- }
- }
+ unsigned int layer= obsrc->lay;
+
+ if(group) {
+ GroupObject *go;
+
+ for(go= group->gobject.first; go; go= go->next) {
+ if( (go->ob->lay & layer) && go->ob->pd && go->ob!=obsrc) {
+ add_to_effectorcache(&listb, go->ob, obsrc);
}
- else if(pd->forcefield) {
- ec= MEM_callocN(sizeof(pEffectorCache), "effector cache");
- ec->ob= ob;
- BLI_addtail(&listb, ec);
+ }
+ }
+ else {
+ for(base = G.scene->base.first; base; base= base->next) {
+ if( (base->lay & layer) && base->object->pd && base->object!=obsrc) {
+ add_to_effectorcache(&listb, base->object, obsrc);
}
}
}
-
+
/* make a full copy */
for(ec= listb.first; ec; ec= ec->next) {
ec->obcopy= *(ec->ob);
@@ -1667,7 +1684,7 @@ void build_particle_system(Object *ob)
}
/* get the effectors */
- effectorbase= pdInitEffectors(ob);
+ effectorbase= pdInitEffectors(ob, paf->group);
/* init geometry, return is 6 x float * me->totvert in size */
vertexcosnos= (VeNoCo *)mesh_get_mapped_verts_nors(ob);
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 65c4ed42e03..7405f16d9c0 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -1,19 +1,12 @@
-/* group.c sept 2000
- * - cleaned up mar-01 nzc
- *
- *
- * ton roosendaal
+/*
* $Id$
*
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ * ***** 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. 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.
+ * 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
@@ -31,7 +24,7 @@
*
* Contributor(s): none yet.
*
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * ***** END GPL LICENSE BLOCK *****
*/
#include <stdio.h>
@@ -57,22 +50,8 @@
#include <config.h>
#endif
-void free_object_key(ObjectKey *ok)
-{
- if(ok->ipo) ok->ipo->id.us--;
-
- MEM_freeN(ok);
-}
-
void free_group_object(GroupObject *go)
{
- ObjectKey *ok;
-
- while(go->okey.first) {
- ok= go->okey.first;
- BLI_remlink(&go->okey, ok);
- free_object_key(ok);
- }
MEM_freeN(go);
}
@@ -82,14 +61,11 @@ void free_group(Group *group)
/* don't free group itself */
GroupObject *go;
- BLI_freelistN(&group->gkey);
-
while(group->gobject.first) {
go= group->gobject.first;
BLI_remlink(&group->gobject, go);
free_group_object(go);
}
-
}
Group *add_group()
@@ -100,97 +76,16 @@ Group *add_group()
return group;
}
-/* assumes 'ok' is unitialized */
-void object_to_obkey(Object *ob, ObjectKey *ok)
-{
- ok->partype= ob->partype;
- ok->par1= ob->par1;
- ok->par2= ob->par2;
- ok->par3= ob->par3;
-
- ok->parent= ob->parent;
- ok->track= ob->track;
-
- ok->ipo= copy_ipo(ob->ipo);
-
- memcpy(ok->loc, ob->loc, 7*3*sizeof(float));
- memcpy(ok->quat, ob->quat, 2*4*sizeof(float));
- memcpy(ok->obmat, ob->obmat, 3*4*4*sizeof(float));
-
- ok->lay= ob->lay;
- ok->transflag= ob->transflag;
- ok->trackflag= ob->transflag;
- ok->upflag= ob->upflag;
- ok->sf= ob->sf;
- ok->ctime= ob->ctime;
-
-
-}
-
-void obkey_to_object(ObjectKey *ok, Object *ob)
-{
- ob->partype= ok->partype;
- ob->par1= ok->par1;
- ob->par2= ok->par2;
- ob->par3= ok->par3;
-
- ob->parent= ok->parent;
- ob->track= ok->track;
-
- /* pretty tricky, this makes ob->ipo blocks with users 'hanging around' */
- if(ob->ipo) {
- free_libblock_us(&G.main->ipo, ob->ipo);
- }
- ob->ipo= copy_ipo(ok->ipo);
-
- memcpy(ob->loc, ok->loc, 7*3*sizeof(float));
- memcpy(ob->quat, ok->quat, 2*4*sizeof(float));
- memcpy(ob->obmat, ok->obmat, 3*4*4*sizeof(float));
-
- ob->lay= ok->lay;
- ob->transflag= ok->transflag;
- ob->trackflag= ok->transflag;
- ob->upflag= ok->upflag;
- ob->sf= ok->sf;
- ob->ctime= ok->ctime;
-}
-
-/* current ob position */
-void add_object_key(GroupObject *go, GroupKey *gk)
-{
- ObjectKey *ok;
-
- /* check if there already is a key */
- ok= go->okey.first;
- while(ok) {
- if(ok->gkey == gk) break;
- ok= ok->next;
- }
-
- if(ok) {
- BLI_remlink(&go->okey, ok);
- free_object_key(ok);
- }
- ok= MEM_mallocN(sizeof(ObjectKey), "objectkey");
- ok->gkey= gk;
-
- object_to_obkey(go->ob, ok);
-
- BLI_addtail(&go->okey, ok);
-
-}
-
/* external */
void add_to_group(Group *group, Object *ob)
{
GroupObject *go;
- GroupKey *gk;
+
+ if(group==NULL || ob==NULL) return;
/* check if the object has been added already */
- go= group->gobject.first;
- while(go) {
+ for(go= group->gobject.first; go; go= go->next) {
if(go->ob==ob) return;
- go= go->next;
}
go= MEM_callocN(sizeof(GroupObject), "groupobject");
@@ -198,18 +93,13 @@ void add_to_group(Group *group, Object *ob)
go->ob= ob;
- /* keys? */
- gk= group->gkey.first;
- while(gk) {
- add_object_key(go, gk);
- gk= gk->next;
- }
}
void rem_from_group(Group *group, Object *ob)
{
GroupObject *go, *gon;
- ObjectKey *ok;
+
+ if(group==NULL || ob==NULL) return;
go= group->gobject.first;
while(go) {
@@ -218,116 +108,31 @@ void rem_from_group(Group *group, Object *ob)
BLI_remlink(&group->gobject, go);
free_group_object(go);
}
- else {
- ok= go->okey.first;
- while(ok) {
- if(ok->parent==ob) ok->parent= NULL;
- if(ok->track==ob) ok->track= NULL;
- ok= ok->next;
- }
- }
go= gon;
}
}
-void add_group_key(Group *group)
+int object_in_group(Object *ob, Group *group)
{
GroupObject *go;
- GroupKey *gk;
- int nr=10;
- extern char colname_array[][20]; /* material.c */
-
- gk= group->gkey.first;
- while(gk) {
- nr++;
- gk= gk->next;
- }
-
- gk= MEM_callocN(sizeof(GroupKey), "groupkey");
- BLI_addtail(&group->gkey, gk);
- strcpy(gk->name, colname_array[ nr % 120 ]);
-
- go= group->gobject.first;
- while(go) {
- add_object_key(go, gk);
- go= go->next;
- }
-
- group->active= gk;
-}
-
-void set_object_key(Object *ob, ObjectKey *ok)
-{
- obkey_to_object(ok, ob);
-}
-
-void set_group_key(Group *group)
-{
- /* sets active */
- GroupObject *go;
- ObjectKey *ok;
- if(group->active==NULL) return;
+ if(group==NULL || ob==NULL) return 0;
- go= group->gobject.first;
- while(go) {
- ok= go->okey.first;
- while(ok) {
- if(ok->gkey==group->active) {
- set_object_key(go->ob, ok);
- break;
- }
- ok= ok->next;
- }
- go= go->next;
+ for(go= group->gobject.first; go; go= go->next) {
+ if(go->ob==ob)
+ return 1;
}
-
+ return 0;
}
Group *find_group(Object *ob)
{
Group *group= G.main->group.first;
- GroupObject *go;
while(group) {
-
- go= group->gobject.first;
- while(go) {
- if(go->ob==ob) return group;
- go= go->next;
- }
+ if(object_in_group(ob, group))
+ return group;
group= group->id.next;
}
return NULL;
}
-
-void set_group_key_name(Group *group, char *name)
-{
- GroupKey *gk;
-
- if(group==NULL) return;
-
- gk= group->gkey.first;
- while(gk) {
- if(strcmp(name, gk->name)==0) break;
- gk= gk->next;
- }
-
- if(gk) {
- group->active= gk;
- set_group_key(group);
- }
-}
-
-void set_group_key_frame(Group *group, float frame)
-{
- GroupObject *go;
-
- if(group==NULL) return;
-
- go= group->gobject.first;
- while(go) {
- where_is_object_time(go->ob, frame);
- go= go->next;
- }
-}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 53b4a09d89b..2cd387d7d93 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -220,16 +220,16 @@ Scene *add_scene(char *name)
return sce;
}
-int object_in_scene(Object *ob, Scene *sce)
+Base *object_in_scene(Object *ob, Scene *sce)
{
Base *base;
base= sce->base.first;
while(base) {
- if(base->object == ob) return 1;
+ if(base->object == ob) return base;
base= base->next;
}
- return 0;
+ return NULL;
}
void set_scene_bg(Scene *sce)
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 5b98a3bf794..d81c0e94944 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -546,7 +546,7 @@ static void softbody_calc_forces(Object *ob, float forcetime)
/* check! */
do_deflector= is_there_deflection(ob->lay);
- do_effector= pdInitEffectors(ob);
+ do_effector= pdInitEffectors(ob, NULL);
iks = 1.0f/(1.0f-sb->inspring)-1.0f ;/* inner spring constants function */
bproot= sb->bpoint; /* need this for proper spring addressing */
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index ceb226f67fb..8c7fd8de053 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -83,7 +83,7 @@ static IDType idtypes[]= {
{ ID_AR, "Armature", IDTYPE_FLAGS_ISLINKABLE},
{ ID_CA, "Camera", IDTYPE_FLAGS_ISLINKABLE},
{ ID_CU, "Curve", IDTYPE_FLAGS_ISLINKABLE},
- { ID_GR, "Group", 0},
+ { ID_GR, "Group", IDTYPE_FLAGS_ISLINKABLE},
{ ID_ID, "ID", 0},
{ ID_IM, "Image", IDTYPE_FLAGS_ISLINKABLE},
{ ID_IP, "Ipo", IDTYPE_FLAGS_ISLINKABLE},
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5207c79b0ca..bd9709edb5e 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2129,6 +2129,7 @@ static void lib_link_modifiers(FileData *fd, Object *ob)
static void lib_link_object(FileData *fd, Main *main)
{
Object *ob;
+ PartEff *paf;
bSensor *sens;
bController *cont;
bActuator *act;
@@ -2143,7 +2144,8 @@ static void lib_link_object(FileData *fd, Main *main)
ob->track= newlibadr(fd, ob->id.lib, ob->track);
ob->ipo= newlibadr_us(fd, ob->id.lib, ob->ipo);
ob->action = newlibadr_us(fd, ob->id.lib, ob->action);
-
+ ob->dup_group= newlibadr_us(fd, ob->id.lib, ob->dup_group);
+
poin= ob->data;
ob->data= newlibadr_us(fd, ob->id.lib, ob->data);
@@ -2164,6 +2166,11 @@ static void lib_link_object(FileData *fd, Main *main)
lib_link_nlastrips(fd, &ob->id, &ob->nlastrips);
lib_link_constraint_channels(fd, &ob->id, &ob->constraintChannels);
+ for(paf= ob->effect.first; paf; paf= paf->next) {
+ if(paf->type==EFF_PARTICLE) {
+ paf->group= newlibadr_us(fd, ob->id.lib, paf->group);
+ }
+ }
sens= ob->sensors.first;
while(sens) {
@@ -2337,7 +2344,7 @@ static void direct_link_object(FileData *fd, Object *ob)
paf= ob->effect.first;
while(paf) {
if(paf->type==EFF_PARTICLE) {
- paf->keys= 0;
+ paf->keys= NULL;
}
if(paf->type==EFF_WAVE) {
WaveEff *wav = (WaveEff*) paf;
@@ -2496,7 +2503,6 @@ static void lib_link_scene(FileData *fd, Main *main)
sce->world= newlibadr_us(fd, sce->id.lib, sce->world);
sce->set= newlibadr(fd, sce->id.lib, sce->set);
sce->ima= newlibadr_us(fd, sce->id.lib, sce->ima);
- sce->group= newlibadr_us(fd, sce->id.lib, sce->group);
base= sce->base.first;
while(base) {
@@ -3140,30 +3146,13 @@ static void lib_link_sound(FileData *fd, Main *main)
static void direct_link_group(FileData *fd, Group *group)
{
- GroupObject *go;
- ObjectKey *ok;
-
link_list(fd, &group->gobject);
- link_list(fd, &group->gkey);
- group->active= newdataadr(fd, group->active);
-
- go= group->gobject.first;
- while(go) {
- link_list(fd, &go->okey);
- ok= go->okey.first;
- while(ok) {
- ok->gkey= newdataadr(fd, ok->gkey);
- ok= ok->next;
- }
- go= go->next;
- }
}
static void lib_link_group(FileData *fd, Main *main)
{
Group *group= main->group.first;
GroupObject *go;
- ObjectKey *ok;
while(group) {
if(group->id.flag & LIB_NEEDLINK) {
@@ -3172,15 +3161,12 @@ static void lib_link_group(FileData *fd, Main *main)
go= group->gobject.first;
while(go) {
go->ob= newlibadr(fd, group->id.lib, go->ob);
- ok= go->okey.first;
- while(ok) {
- ok->parent= newlibadr(fd, group->id.lib, ok->parent);
- ok->track= newlibadr(fd, group->id.lib, ok->track);
- ok->ipo= newlibadr_us(fd, group->id.lib, ok->ipo);
- ok= ok->next;
- }
+ /* groups have inverse users... */
+ if(go->ob && group->id.us==0)
+ group->id.us= 1;
go= go->next;
}
+ rem_from_group(group, NULL); /* removes NULL entries */
}
group= group->id.next;
}
@@ -5291,6 +5277,15 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
}
}
+static void expand_group(FileData *fd, Main *mainvar, Group *group)
+{
+ GroupObject *go;
+
+ for(go= group->gobject.first; go; go= go->next) {
+ expand_doit(fd, mainvar, go->ob);
+ }
+}
+
static void expand_key(FileData *fd, Main *mainvar, Key *key)
{
expand_doit(fd, mainvar, key->ipo);
@@ -5729,6 +5724,9 @@ static void expand_main(FileData *fd, Main *mainvar)
case ID_AC:
expand_action(fd, mainvar, (bAction *)id);
break;
+ case ID_GR:
+ expand_group(fd, mainvar, (Group *)id);
+ break;
}
doit= 1;
@@ -5758,8 +5756,9 @@ static void give_base_to_objects(Scene *sce, ListBase *lb)
BLI_addtail(&(sce->base), base);
base->lay= ob->lay;
base->object= ob;
+ base->flag= ob->flag;
ob->id.us= 1;
-
+
ob->id.flag -= LIB_INDIRECT;
ob->id.flag |= LIB_EXTERN;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 0fd394428e3..d2e1d7e2c6c 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1492,9 +1492,7 @@ static void write_sounds(WriteData *wd, ListBase *idbase)
static void write_groups(WriteData *wd, ListBase *idbase)
{
Group *group;
- GroupKey *gk;
GroupObject *go;
- ObjectKey *ok;
group= idbase->first;
while(group) {
@@ -1502,27 +1500,11 @@ static void write_groups(WriteData *wd, ListBase *idbase)
/* write LibData */
writestruct(wd, ID_GR, "Group", 1, group);
- gk= group->gkey.first;
- while(gk) {
- writestruct(wd, DATA, "GroupKey", 1, gk);
- gk= gk->next;
- }
-
go= group->gobject.first;
while(go) {
writestruct(wd, DATA, "GroupObject", 1, go);
go= go->next;
}
- go= group->gobject.first;
- while(go) {
- ok= go->okey.first;
- while(ok) {
- writestruct(wd, DATA, "ObjectKey", 1, ok);
- ok= ok->next;
- }
- go= go->next;
- }
-
}
group= group->id.next;
}
diff --git a/source/blender/include/BIF_editgroup.h b/source/blender/include/BIF_editgroup.h
index 01102649fd6..e86bd962a6c 100644
--- a/source/blender/include/BIF_editgroup.h
+++ b/source/blender/include/BIF_editgroup.h
@@ -31,10 +31,8 @@
*/
struct Group;
-void set_active_group(void);
-void add_selected_to_group(void);
+
+void add_selected_to_group(struct Group *group);
void rem_selected_from_group(void);
-void prev_group_key(struct Group *group);
-void next_group_key(struct Group *group);
-void select_group_menu(void);
-void select_group(short nr);
+void group_operation_with_menu(void);
+
diff --git a/source/blender/include/BIF_resources.h b/source/blender/include/BIF_resources.h
index 8c05d96ec72..b9b1d1f63bf 100644
--- a/source/blender/include/BIF_resources.h
+++ b/source/blender/include/BIF_resources.h
@@ -117,8 +117,8 @@ typedef enum {
ICON_ENVMAP,
ICON_TRANSP_HLT,
ICON_TRANSP_DEHLT,
- ICON_RADIO_DEHLT,
- ICON_RADIO_HLT,
+ ICON_CIRCLE_DEHLT,
+ ICON_CIRCLE_HLT,
ICON_TPAINT_DEHLT,
ICON_TPAINT_HLT,
ICON_WPAINT_DEHLT,
diff --git a/source/blender/include/BIF_space.h b/source/blender/include/BIF_space.h
index b51d844403c..7970ed5e41d 100644
--- a/source/blender/include/BIF_space.h
+++ b/source/blender/include/BIF_space.h
@@ -114,8 +114,7 @@ extern void newspace(struct ScrArea *sa, int type);
extern void set_rects_butspace(struct SpaceButs *buts);
extern void test_butspace(void);
extern void start_game(void);
-extern void select_group_menu(void);
-extern void select_group(short nr);
+extern void select_grouped(short nr);
extern void BIF_undo_push(char *str);
extern void BIF_undo(void);
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
index e62eb268ed9..8e72198da52 100644
--- a/source/blender/include/butspace.h
+++ b/source/blender/include/butspace.h
@@ -121,6 +121,8 @@ void test_scenepoin_but(char *name, struct ID **idpp);
void test_matpoin_but(char *name, struct ID **idpp);
void test_scriptpoin_but(char *name, struct ID **idpp);
void test_actionpoin_but(char *name, ID **idpp);
+void test_grouppoin_but(char *name, ID **idpp);
+
void test_idbutton_cb(void *namev, void *arg2_unused);
/* -------------- internal event defines ------------ */
@@ -222,7 +224,7 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
#define B_ENV_FREE_ALL 1357
#define B_UNLINKIMA 1358
-/* *********************** */
+/* **************** animbuts = object buttons ******* */
#define B_ANIMBUTS 1500
#define B_RECALCPATH 1401
@@ -238,15 +240,14 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
#define B_SOFTBODY_BAKE 1422
#define B_SOFTBODY_BAKE_FREE 1423
- /* this has MAX_EFFECT settings! Next free define is 1450... */
-#define B_SELEFFECT 1430
+/* this has MAX_EFFECT settings! Next free define is 1450... */
+#define B_SELEFFECT 1430
/* Fluidsim button defines */
#define B_FLUIDSIM_BAKE 1450
-#define B_FLUIDSIM_SELDIR 1451
+#define B_FLUIDSIM_SELDIR 1451
#define B_FLUIDSIM_FORCEREDRAW 1452
-
/* *********************** */
#define B_WORLDBUTS 1600
diff --git a/source/blender/makesdna/DNA_effect_types.h b/source/blender/makesdna/DNA_effect_types.h
index 46ce9b7d017..86ffb0fc4ad 100644
--- a/source/blender/makesdna/DNA_effect_types.h
+++ b/source/blender/makesdna/DNA_effect_types.h
@@ -104,6 +104,7 @@ typedef struct Particle {
short mat_nr, rt;
} Particle;
+struct Group;
typedef struct PartEff {
struct PartEff *next, *prev;
@@ -125,7 +126,9 @@ typedef struct PartEff {
short disp, vertgroup_v;
char vgroupname[32], vgroupname_v[32];
+
Particle *keys;
+ struct Group *group;
} PartEff;
diff --git a/source/blender/makesdna/DNA_group_types.h b/source/blender/makesdna/DNA_group_types.h
index f7139101476..2ee699839ed 100644
--- a/source/blender/makesdna/DNA_group_types.h
+++ b/source/blender/makesdna/DNA_group_types.h
@@ -38,50 +38,11 @@
#include "DNA_ID.h"
struct Object;
-struct Ipo;
-
-typedef struct GroupKey {
- struct GroupKey *next, *prev;
- short sfra, efra;
- float cfra;
- char name[32];
-} GroupKey;
-
-typedef struct ObjectKey {
- struct ObjectKey *next, *prev;
- GroupKey *gkey; /* for reference */
-
- /* copy of relevant data */
- short partype, pad;
- int par1, par2, par3;
-
- struct Object *parent, *track;
- struct Ipo *ipo;
-
- /* this block identical to object */
- float loc[3], dloc[3], orig[3];
- float size[3], dsize[3];
- float rot[3], drot[3];
- float quat[4], dquat[4];
- float obmat[4][4];
- float parentinv[4][4];
- float imat[4][4]; /* voor bij render, tijdens simulate, tijdelijk: ipokeys van transform */
-
- unsigned int lay; /* kopie van Base */
-
- char transflag, ipoflag;
- char trackflag, upflag;
-
- float sf, ctime, padf;
-
-
-} ObjectKey;
typedef struct GroupObject {
struct GroupObject *next, *prev;
struct Object *ob;
- ListBase okey; /* ObjectKey */
-
+ void *lampren; /* used while render */
} GroupObject;
@@ -89,11 +50,9 @@ typedef struct Group {
ID id;
ListBase gobject; /* GroupObject */
- ListBase gkey; /* GroupKey */
-
- GroupKey *active;
} Group;
+
#endif
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 3f74370ac1f..bbe7d0f8125 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -46,6 +46,7 @@ struct MTex;
struct Ipo;
struct Material;
struct ColorBand;
+struct Group;
typedef struct MaterialLayer {
struct MaterialLayer *next, *prev;
@@ -109,6 +110,7 @@ typedef struct Material {
struct MTex *mtex[10];
ListBase layers;
struct Ipo *ipo;
+ struct Group *group;
/* dynamic properties */
float friction, fh, reflect;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 1d16015a628..88075e718de 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -188,10 +188,7 @@ typedef struct Object {
struct PartDeflect *pd; /* particle deflector/attractor/collision data */
struct SoftBody *soft; /* if exists, saved in file */
- struct Life *life;
-
- LBuf lbuf;
- LBuf port;
+ struct Group *dup_group; /* object duplicator for group */
short fluidsimFlag; /* NT toggle fluidsim participation on/off */
char shapenr, shapeflag; /* current shape key for menu or pinned, flag for pinning */
@@ -262,13 +259,13 @@ extern Object workob;
#define OB_OFFS_LOCAL 1
#define OB_QUAT 2
#define OB_NEG_SCALE 4
-#define OB_DUPLI (8+16)
+#define OB_DUPLI (8+16+256)
#define OB_DUPLIFRAMES 8
#define OB_DUPLIVERTS 16
#define OB_DUPLIROT 32
#define OB_DUPLINOSPEED 64
-
#define OB_POWERTRACK 128
+#define OB_DUPLIGROUP 256
/* (short) ipoflag */
#define OB_DRAWKEY 1
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 6323caeda6c..968aa6abe56 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -289,7 +289,6 @@ typedef struct Scene {
ListBase base;
struct Base *basact;
- struct Group *group;
float cursor[3];
float twcent[3]; /* center for transform widget */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 7007981ff64..5a7e84c62ef 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -483,6 +483,7 @@ typedef struct SpaceImaSel {
#define SO_SELECTED 3
#define SO_ACTIVE 4
#define SO_SAME_TYPE 5
+#define SO_GROUPS 6
/* SpaceOops->storeflag */
#define SO_TREESTORE_CLEANUP 1
diff --git a/source/blender/render/extern/include/render_types.h b/source/blender/render/extern/include/render_types.h
index ea3463f96ae..531a7fc5ceb 100644
--- a/source/blender/render/extern/include/render_types.h
+++ b/source/blender/render/extern/include/render_types.h
@@ -146,6 +146,7 @@ typedef struct RE_Render
int totvlak, totvert, tothalo, totlamp;
/* internal, fortunately */
+ ListBase lights;
struct LampRen **la;
struct VlakRen **blovl;
struct VertRen **blove;
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index f3d8ef94d8e..f7c31fa099a 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -50,7 +50,7 @@
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h" /* for rectcpy */
-#include "DNA_texture_types.h"
+#include "DNA_group_types.h"
#include "DNA_image_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -271,6 +271,7 @@ static void envmap_transmatrix(float mat[][4], int part)
static void env_rotate_scene(float mat[][4], int mode)
{
+ GroupObject *go;
VlakRen *vlr = NULL;
VertRen *ver = NULL;
LampRen *lar = NULL;
@@ -326,8 +327,8 @@ static void env_rotate_scene(float mat[][4], int mode)
set_normalflags();
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=R.lights.first; go; go= go->next) {
+ lar= go->lampren;
/* removed here some horrible code of someone in NaN who tried to fix
prototypes... just solved by introducing a correct cmat[3][3] instead
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 54cfc1742e8..1f1ffc20cf5 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -466,33 +466,8 @@ static void free_filt_mask()
MEM_freeN(centmask);
}
-/* unused */
-
-#if 0
-void defaultlamp()
-{
- LampRen *lar;
-
- lar= (LampRen *)MEM_callocN(sizeof(LampRen),"lampren");
- R.la[R.totlamp++]=lar;
-
- lar->type= LA_SUN;
- lar->vec[0]= -R.viewmat[2][0];
- lar->vec[1]= -R.viewmat[2][1];
- lar->vec[2]= -R.viewmat[2][2];
- Normalise(lar->vec);
- lar->r= 1.0;
- lar->g= 1.0;
- lar->b= 1.0;
- lar->lay= 65535;
-}
-#endif
-
-
-
/* ********************* init calls *********************** */
-
static void init_def_material(void)
{
Material *ma;
@@ -511,7 +486,6 @@ void RE_init_render_data(void)
R.blove= (VertRen **)MEM_callocN(sizeof(void *)*(TABLEINITSIZE),"Blove");
R.blovl= (VlakRen **)MEM_callocN(sizeof(void *)*(TABLEINITSIZE),"Blovl");
R.bloha= (HaloRen **)MEM_callocN(sizeof(void *)*(TABLEINITSIZE),"Bloha");
- R.la= (LampRen **)MEM_mallocN(LAMPINITSIZE*sizeof(void *),"renderlamparray");
init_def_material();
init_filt_mask();
@@ -525,8 +499,7 @@ void RE_free_render_data()
R.blovl= NULL;
MEM_freeN(R.bloha);
R.bloha= NULL;
- MEM_freeN(R.la);
- R.la= NULL;
+
if(R.rectot) MEM_freeN(R.rectot);
if(R.rectftot) MEM_freeN(R.rectftot);
if(R.rectz) MEM_freeN(R.rectz);
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 9d6e7b421d5..6bb0ce04533 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -45,6 +45,7 @@
#include "MTC_vectorops.h"
#include "DNA_camera_types.h"
+#include "DNA_group_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_image_types.h"
@@ -160,10 +161,10 @@ extern float hashvectf[];
static void render_lighting_halo(HaloRen *har, float *colf)
{
+ GroupObject *go;
LampRen *lar;
float i, inp, inpr, rco[3], dco[3], lv[3], lampdist, ld, t, *vn;
float ir, ig, ib, shadfac, soft, lacol[3];
- int a;
ir= ig= ib= 0.0;
@@ -172,8 +173,8 @@ static void render_lighting_halo(HaloRen *har, float *colf)
vn= har->no;
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=R.lights.first; go; go= go->next) {
+ lar= go->lampren;
/* test for lamplayer */
if(lar->mode & LA_LAYER) if((lar->lay & har->lay)==0) continue;
@@ -496,7 +497,7 @@ void shadeHaloFloat(HaloRen *har, float *col, int zz,
if(har->mat) {
if(har->mat->mode & MA_HALO_SHADE) {
/* we test for lights because of preview... */
- if(R.totlamp) render_lighting_halo(har, col);
+ if(R.lights.first) render_lighting_halo(har, col);
}
/* Next, we do the line and ring factor modifications. */
diff --git a/source/blender/render/intern/source/renderPreAndPost.c b/source/blender/render/intern/source/renderPreAndPost.c
index defb6b97ff6..0753a73276b 100644
--- a/source/blender/render/intern/source/renderPreAndPost.c
+++ b/source/blender/render/intern/source/renderPreAndPost.c
@@ -34,6 +34,8 @@
#include "MEM_guardedalloc.h"
+#include "DNA_group_types.h"
+
#include "render.h"
#include "renderPreAndPost.h"
#include "RE_callbacks.h"
@@ -52,15 +54,16 @@
*/
void prepareScene()
{
- int a;
+ GroupObject *go;
extern void makeoctree(void);
RE_local_get_renderdata();
/* SHADOW BUFFER */
- for(a=0; a<R.totlamp; a++) {
+ for(go=R.lights.first; go; go= go->next) {
+ LampRen *lar= go->lampren;
+ if(lar->shb) makeshadowbuf(lar);
if(RE_local_test_break()) break;
- if(R.la[a]->shb) makeshadowbuf(R.la[a]);
}
/* yafray: 'direct' radiosity, environment maps and octree init not needed for yafray render */
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 4d29ffe3b43..99e9384f5b8 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -42,12 +42,13 @@
#include "BKE_utildefines.h"
+#include "DNA_camera_types.h"
+#include "DNA_group_types.h"
+#include "DNA_image_types.h"
+#include "DNA_lamp_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
-#include "DNA_image_types.h"
#include "DNA_object_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_lamp_types.h"
#include "DNA_texture_types.h"
#include "BKE_global.h"
@@ -406,14 +407,15 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
static void renderspothalo(ShadeInput *shi, float *col, float alpha)
{
+ GroupObject *go;
LampRen *lar;
float i;
- int a;
if(alpha==0.0f) return;
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=R.lights.first; go; go= go->next) {
+ lar= go->lampren;
+
if(lar->type==LA_SPOT && (lar->mode & LA_HALO) && lar->haint>0) {
spothalo(lar, shi, &i);
@@ -1354,11 +1356,12 @@ static void ambient_occlusion(World *wrld, ShadeInput *shi, ShadeResult *shr)
void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
{
LampRen *lar;
+ GroupObject *go;
Material *ma= shi->mat;
VlakRen *vlr= shi->vlr;
+ ListBase *lights;
float i, inp, inpr, is, t, lv[3], vnor[3], lacol[3], lampdist, ld = 0;
float lvrot[3], *vn, *view, shadfac[4], soft, phongcorr; // shadfac = rgba
- int a;
vn= shi->vn;
view= shi->view;
@@ -1371,6 +1374,12 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shi->har= ma->har;
if((ma->mode & MA_RAYMIRROR)==0) shi->ray_mirror= 0.0;
+ /* lights */
+ if(ma->group)
+ lights= &ma->group->gobject;
+ else
+ lights= &R.lights;
+
/* separate loop */
if(ma->mode & MA_ONLYSHADOW) {
float ir;
@@ -1378,8 +1387,10 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
if(R.r.mode & R_SHADOW) {
shadfac[3]= ir= 0.0;
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=lights->first; go; go= go->next) {
+ lar= go->lampren;
+ if(lar==NULL) continue;
+
/* yafray: ignore shading by photonlights, not used in Blender */
if (lar->type==LA_YF_PHOTON) continue;
@@ -1505,8 +1516,10 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
ambient_occlusion(&R.wrld, shi, shr);
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=lights->first; go; go= go->next) {
+ lar= go->lampren;
+ if(lar==NULL) continue;
+
/* yafray: ignore shading by photonlights, not used in Blender */
if (lar->type==LA_YF_PHOTON) continue;
diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c
index 665bd3ce6de..14726c6ca84 100644
--- a/source/blender/renderconverter/intern/convertBlenderScene.c
+++ b/source/blender/renderconverter/intern/convertBlenderScene.c
@@ -53,6 +53,7 @@
#include "DNA_material_types.h"
#include "DNA_curve_types.h"
#include "DNA_effect_types.h"
+#include "DNA_group_types.h"
#include "DNA_lamp_types.h"
#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
@@ -74,6 +75,7 @@
#include "BKE_DerivedMesh.h"
#include "BKE_effect.h"
#include "BKE_global.h"
+#include "BKE_group.h"
#include "BKE_key.h"
#include "BKE_ipo.h"
#include "BKE_lattice.h"
@@ -1658,23 +1660,10 @@ static void area_lamp_vectors(LampRen *lar)
void RE_add_render_lamp(Object *ob, int actual_render)
{
Lamp *la;
- LampRen *lar, **temp;
+ LampRen *lar;
+ GroupObject *go;
float mat[4][4], hoek, xn, yn;
int c;
- static int rlalen=LAMPINITSIZE; /*number of currently allocated lampren pointers*/
-
- if(R.totlamp>=rlalen) { /* Need more Lamp pointers....*/
- printf("Alocating %i more lamp groups, %i total.\n",
- LAMPINITSIZE, rlalen+LAMPINITSIZE);
- temp=R.la;
- R.la=(LampRen**)MEM_callocN(sizeof(void*)*(rlalen+LAMPINITSIZE) , "renderlamparray");
- memcpy(R.la, temp, rlalen*sizeof(void*));
- memset(&(R.la[R.totlamp]), 0, LAMPINITSIZE*sizeof(void*));
- rlalen+=LAMPINITSIZE;
- MEM_freeN(temp);
- }
-
- la= ob->data;
/* prevent only shadow from rendering light, but only return on render, not preview */
if(actual_render) {
@@ -1682,9 +1671,13 @@ void RE_add_render_lamp(Object *ob, int actual_render)
if((R.r.mode & R_SHADOW)==0)
return;
}
-
+
+ go= MEM_callocN(sizeof(GroupObject), "groupobject");
+ BLI_addtail(&R.lights, go);
+ R.totlamp++;
lar= (LampRen *)MEM_callocN(sizeof(LampRen),"lampren");
- R.la[R.totlamp++]= lar;
+ go->lampren= lar;
+ go->ob= ob;
MTC_Mat4MulMat4(mat, ob->obmat, R.viewmat);
MTC_Mat4Invert(ob->imat, mat);
@@ -1692,6 +1685,8 @@ void RE_add_render_lamp(Object *ob, int actual_render)
MTC_Mat3CpyMat4(lar->mat, mat);
MTC_Mat3CpyMat4(lar->imat, ob->imat);
+ la= ob->data;
+
lar->bufsize = la->bufsize;
lar->samp = la->samp;
lar->soft = la->soft;
@@ -2360,6 +2355,7 @@ void RE_freeRotateBlenderScene(void)
{
ShadBuf *shb;
Object *ob = NULL;
+ GroupObject *go;
unsigned long *ztile;
int a, b, v;
char *ctile;
@@ -2368,10 +2364,11 @@ void RE_freeRotateBlenderScene(void)
BLI_memarena_free(R.memArena);
R.memArena = NULL;
-
- for(a=0; a<R.totlamp; a++) {
- if(R.la[a]->shb) {
- shb= R.la[a]->shb;
+
+ for(go= R.lights.first; go; go= go->next) {
+ struct LampRen *lar= go->lampren;
+ if(lar->shb) {
+ shb= lar->shb;
v= (shb->size*shb->size)/256;
ztile= shb->zbuf;
ctile= shb->cbuf;
@@ -2381,11 +2378,13 @@ void RE_freeRotateBlenderScene(void)
MEM_freeN(shb->zbuf);
MEM_freeN(shb->cbuf);
- MEM_freeN(R.la[a]->shb);
+ MEM_freeN(lar->shb);
}
- if(R.la[a]->jitter) MEM_freeN(R.la[a]->jitter);
- MEM_freeN(R.la[a]);
+ if(lar->jitter) MEM_freeN(lar->jitter);
+ MEM_freeN(lar);
}
+
+ BLI_freelistN(&R.lights);
/* note; these pointer arrays were allocated, with last element NULL to stop loop */
a=0;
@@ -2573,7 +2572,25 @@ static void check_non_flat_quads(void)
}
}
-
+static void set_material_lightgroups(void)
+{
+ GroupObject *go, *gol;
+ Material *ma;
+
+ /* it's a bit too many loops in loops... but will survive */
+ for(ma= G.main->mat.first; ma; ma=ma->id.next) {
+ if(ma->group) {
+ for(go= ma->group->gobject.first; go; go= go->next) {
+ for(gol= R.lights.first; gol; gol= gol->next) {
+ if(gol->ob==go->ob) {
+ go->lampren= gol->lampren;
+ break;
+ }
+ }
+ }
+ }
+ }
+}
extern int slurph_opt; /* key.c */
extern ListBase duplilist;
@@ -2585,13 +2602,12 @@ void RE_rotateBlenderScene(void)
unsigned int lay;
float mat[4][4];
- if(G.scene->camera==0) return;
+ if(G.scene->camera==NULL) return;
R.memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
-
- slurph_opt= 0;
-
R.totvlak=R.totvert=R.totlamp=R.tothalo= 0;
+
+ slurph_opt= 0;
/* in localview, lamps are using normal layers, objects only local bits */
if(G.scene->lay & 0xFF000000) lay= G.scene->lay & 0xFF000000;
@@ -2772,7 +2788,9 @@ void RE_rotateBlenderScene(void)
}
sort_halos();
-
+
+ set_material_lightgroups();
+
if(R.wrld.mode & WO_STARS) RE_make_stars(NULL, NULL, NULL);
slurph_opt= 1;
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c
index bb6dc671e14..752e831c2b4 100644
--- a/source/blender/src/butspace.c
+++ b/source/blender/src/butspace.c
@@ -107,7 +107,7 @@ void test_scriptpoin_but(char *name, ID **idpp)
}
id= id->next;
}
- *idpp= 0;
+ *idpp= NULL;
}
void test_actionpoin_but(char *name, ID **idpp)
@@ -122,7 +122,7 @@ void test_actionpoin_but(char *name, ID **idpp)
}
id= id->next;
}
- *idpp= 0;
+ *idpp= NULL;
}
@@ -144,7 +144,7 @@ void test_obpoin_but(char *name, ID **idpp)
}
id= id->next;
}
- *idpp= 0;
+ *idpp= NULL;
}
void test_meshpoin_but(char *name, ID **idpp)
@@ -162,7 +162,7 @@ void test_meshpoin_but(char *name, ID **idpp)
}
id= id->next;
}
- *idpp= 0;
+ *idpp= NULL;
}
void test_matpoin_but(char *name, ID **idpp)
@@ -180,7 +180,7 @@ void test_matpoin_but(char *name, ID **idpp)
}
id= id->next;
}
- *idpp= 0;
+ *idpp= NULL;
}
void test_scenepoin_but(char *name, ID **idpp)
@@ -198,7 +198,25 @@ void test_scenepoin_but(char *name, ID **idpp)
}
id= id->next;
}
- *idpp= 0;
+ *idpp= NULL;
+}
+
+void test_grouppoin_but(char *name, ID **idpp)
+{
+ ID *id;
+
+ if( *idpp ) (*idpp)->us--;
+
+ id= G.main->group.first;
+ while(id) {
+ if( strcmp(name, id->name+2)==0 ) {
+ *idpp= id;
+ id_us_plus(id);
+ return;
+ }
+ id= id->next;
+ }
+ *idpp= NULL;
}
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 8281ce7bc8f..2ac7b28cd53 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -119,6 +119,7 @@
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_font.h"
+#include "BKE_group.h"
#include "BKE_image.h"
#include "BKE_ipo.h"
#include "BKE_lattice.h"
@@ -1133,118 +1134,6 @@ void do_constraintbuts(unsigned short event)
allqueue (REDRAWBUTSOBJECT, 0);
}
-void object_panel_constraint(char *context)
-{
- uiBlock *block;
- Object *ob= OBACT;
- ListBase *conlist;
- bConstraint *curcon;
- short xco, yco;
- char str[64];
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_constraint", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Constraints", context, 640, 0, 318, 204)==0) return;
-
- /* this is a variable height panel, newpanel doesnt force new size on existing panels */
- /* so first we make it default height */
- uiNewPanelHeight(block, 204);
-
- if(G.obedit==OBACT) return; // ??
-
- conlist = get_active_constraints(OBACT);
-
- if (conlist) {
-
- uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint", 0, 190, 130, 20, "Add a new constraint");
-
- /* print active object or bone */
- str[0]= 0;
- if (ob->flag & OB_POSEMODE){
- bPoseChannel *pchan= get_active_posechannel(ob);
- if(pchan) sprintf(str, "To Bone: %s", pchan->name);
- }
- else {
- sprintf(str, "To Object: %s", ob->id.name+2);
- }
- uiDefBut(block, LABEL, 1, str, 150, 190, 150, 20, NULL, 0.0, 0.0, 0, 0, "Displays Active Object or Bone name");
-
- /* Go through the list of constraints and draw them */
- xco = 10;
- yco = 160;
-
- for (curcon = conlist->first; curcon; curcon=curcon->next) {
- /* hrms, the temporal constraint should not draw! */
- if(curcon->type==CONSTRAINT_TYPE_KINEMATIC) {
- bKinematicConstraint *data= curcon->data;
- if(data->flag & CONSTRAINT_IK_TEMP)
- continue;
- }
- /* Draw default constraint header */
- draw_constraint(block, conlist, curcon, &xco, &yco);
- }
-
- if(yco < 0) uiNewPanelHeight(block, 204-yco);
-
- }
-}
-
-static void object_panel_draw(Object *ob)
-{
- uiBlock *block;
- int xco, a, dx, dy;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_draw", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Draw", "Object", 320, 0, 318, 204)==0) return;
-
- /* LAYERS */
- xco= 120;
- dx= 35;
- dy= 30;
-
- uiDefBut(block, LABEL, 0, "Layers", 10,170,100,20, NULL, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
-
- xco+= 7;
- uiBlockBeginAlign(block);
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
-
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Drawtype", 10,120,100,20, NULL, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButC(block, ROW, REDRAWVIEW3D, "Shaded", 10,100,100, 20, &ob->dt, 0, OB_SHADED, 0, 0, "Draw active object shaded or textured");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Solid", 10,80,100, 20, &ob->dt, 0, OB_SOLID, 0, 0, "Draw active object in solid");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Wire", 10,60, 100, 20, &ob->dt, 0, OB_WIRE, 0, 0, "Draw active object in wireframe");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Bounds", 10,40, 100, 20, &ob->dt, 0, OB_BOUNDBOX, 0, 0, "Only draw object with bounding box");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Draw Extra", 120,120,90,20, NULL, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitC(block, TOG, OB_BOUNDBOX, REDRAWVIEW3D, "Bounds", 120, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's bounds");
- uiDefButBitC(block, TOG, OB_DRAWNAME, REDRAWVIEW3D, "Name", 210, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's name");
-
- uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder%x4",
- 120, 80, 90, 20, &ob->boundtype, 0, 0, 0, 0, "Selects the boundary display type");
- uiDefButBitC(block, TOG, OB_AXIS, REDRAWVIEW3D, "Axis", 210, 80, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's centre and axis");
-
- uiDefButBitC(block, TOG, OB_TEXSPACE, REDRAWVIEW3D, "TexSpace", 120, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's texture space");
- uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 210, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Adds the active object's wireframe over solid drawing");
-
- uiDefButBitC(block, TOG, OB_DRAWTRANSP, REDRAWVIEW3D, "Transp", 120, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Enables transparent materials for the active object (Mesh only)");
- uiDefButBitC(block, TOG, OB_DRAWXRAY, REDRAWVIEW3D, "X-ray", 210, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Makes the active object draw in front of others");
-
-}
-
static void softbody_bake(Object *ob)
{
SoftBody *sb= ob->soft;
@@ -1473,56 +1362,263 @@ void do_object_panels(unsigned short event)
}
+static void do_add_groupmenu(void *arg, int event)
+{
+ Object *ob= OBACT;
+
+ if(ob) {
+
+ if(event== -1) {
+ Group *group= add_group();
+ add_to_group(group, ob);
+ }
+ else
+ add_to_group(BLI_findlink(&G.main->group, event), ob);
+
+ ob->flag |= OB_FROMGROUP;
+ BASACT->flag |= OB_FROMGROUP;
+ allqueue(REDRAWBUTSOBJECT, 0);
+ allqueue(REDRAWVIEW3D, 0);
+ }
+}
+
+static uiBlock *add_groupmenu(void *arg_unused)
+{
+ uiBlock *block;
+ Group *group;
+ short yco= 0;
+
+ block= uiNewBlock(&curarea->uiblocks, "add_constraintmenu", UI_EMBOSSP, UI_HELV, curarea->win);
+ uiBlockSetButmFunc(block, do_add_groupmenu, NULL);
+
+ uiDefBut(block, BUTM, B_NOP, "ADD NEW", 0, 20, 160, 19, NULL, 0.0, 0.0, 1, -1, "");
+ for(group= G.main->group.first; group; group= group->id.next, yco++) {
+ uiDefBut(block, BUTM, B_NOP, group->id.name+2, 0, -20*yco, 160, 19, NULL, 0.0, 0.0, 1, yco, "");
+ }
+
+ uiTextBoundsBlock(block, 50);
+ uiBlockSetDirection(block, UI_DOWN);
+
+ return block;
+}
+
+static void group_ob_rem(void *gr_v, void *ob_v)
+{
+ Object *ob= OBACT;
+
+ rem_from_group(gr_v, ob);
+ if(find_group(ob)==NULL) {
+ ob->flag &= ~OB_FROMGROUP;
+ BASACT->flag &= ~OB_FROMGROUP;
+ }
+ allqueue(REDRAWBUTSOBJECT, 0);
+ allqueue(REDRAWVIEW3D, 0);
+
+}
+
+static void object_panel_object(Object *ob)
+{
+ uiBlock *block;
+ uiBut *but;
+ Group *group;
+ int a=0, xco;
+
+ block= uiNewBlock(&curarea->uiblocks, "object_panel_object", UI_EMBOSS, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Object and Links", "Object", 0, 0, 318, 204)==0) return;
+
+ /* object name */
+ uiBlockSetCol(block, TH_BUT_SETTING2);
+ xco= std_libbuttons(block, 10, 180, 0, NULL, 0, &ob->id, NULL, &(G.buts->menunr), B_OBALONE, B_OBLOCAL, 0, 0, B_KEEPDATA);
+ uiBlockSetCol(block, TH_AUTO);
+
+ /* parent */
+ uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_OBJECTPANELPARENT, "Par:", xco+5, 180, 305-xco, 20, &ob->parent, "Parent Object");
+
+ uiDefBlockBut(block, add_groupmenu, NULL, "Add to Group", 10,150,150,20, "Add Object to a new Group");
+
+ /* all groups */
+ uiBlockBeginAlign(block);
+ for(group= G.main->group.first; group; group= group->id.next) {
+ if(object_in_group(ob, group)) {
+ but = uiDefBut(block, TEX, B_IDNAME, "GR:", 10, 120-a, 150, 20, group->id.name+2, 0.0, 19.0, 0, 0, "Displays Group name. Click to change.");
+ uiButSetFunc(but, test_idbutton_cb, group->id.name, NULL);
+
+ but = uiDefIconBut(block, BUT, B_NOP, VICON_X, 160, 120-a, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove Group membership");
+ uiButSetFunc(but, group_ob_rem, group, ob);
+
+ a+= 20;
+ }
+ }
+}
+
static void object_panel_anim(Object *ob)
{
uiBlock *block;
char str[32];
block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Anim settings", "Object", 0, 0, 318, 204)==0) return;
+ if(uiNewPanel(curarea, block, "Anim settings", "Object", 320, 0, 318, 204)==0) return;
uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_TRACKBUTS,"TrackX", 24,190,59,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"Y", 85,190,19,19, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"Z", 104,190,19,19, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"-X", 124,190,24,19, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"-Y", 150,190,24,19, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"-Z", 178,190,24,19, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButS(block, ROW,B_TRACKBUTS,"TrackX", 24,180,59,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButS(block, ROW,B_TRACKBUTS,"Y", 85,180,19,19, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButS(block, ROW,B_TRACKBUTS,"Z", 104,180,19,19, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButS(block, ROW,B_TRACKBUTS,"-X", 124,180,24,19, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButS(block, ROW,B_TRACKBUTS,"-Y", 150,180,24,19, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButS(block, ROW,B_TRACKBUTS,"-Z", 178,180,24,19, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object");
uiBlockBeginAlign(block);
- uiDefButS(block, ROW,REDRAWVIEW3D,"UpX", 226,190,45,19, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up");
- uiDefButS(block, ROW,REDRAWVIEW3D,"Y", 274,190,20,19, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up");
- uiDefButS(block, ROW,REDRAWVIEW3D,"Z", 298,190,19,19, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up");
+ uiDefButS(block, ROW,REDRAWVIEW3D,"UpX", 226,180,45,19, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up");
+ uiDefButS(block, ROW,REDRAWVIEW3D,"Y", 274,180,20,19, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up");
+ uiDefButS(block, ROW,REDRAWVIEW3D,"Z", 298,180,19,19, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up");
+
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_DRAWKEY, REDRAWVIEW3D, "Draw Key", 24,160,71,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position");
- uiDefButBitS(block, TOG, OB_DRAWKEYSEL, REDRAWVIEW3D, "Draw Key Sel", 97,160,81,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys");
- uiDefButBitS(block, TOG, OB_POWERTRACK, REDRAWVIEW3D, "Powertrack", 180,160,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off");
- uiDefButBitS(block, TOG, PARSLOW, 0, "SlowPar", 260,160,56,19, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship");
+ uiDefButBitS(block, TOG, OB_DRAWKEY, REDRAWVIEW3D, "Draw Key", 24,155,71,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position");
+ uiDefButBitS(block, TOG, OB_DRAWKEYSEL, REDRAWVIEW3D, "Draw Key Sel", 97,155,81,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys");
+ uiDefButBitS(block, TOG, OB_POWERTRACK, REDRAWVIEW3D, "Powertrack", 180,155,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off");
+ uiDefButBitS(block, TOG, PARSLOW, 0, "SlowPar", 260,155,56,19, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship");
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_DUPLIFRAMES, REDRAWVIEW3D, "DupliFrames", 24,128,89,19, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
- uiDefButBitS(block, TOG, OB_DUPLIVERTS, REDRAWVIEW3D, "DupliVerts", 114,128,82,19, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices");
- uiDefButBitS(block, TOG, OB_DUPLIROT, REDRAWVIEW3D, "Rot", 200,128,31,19, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal");
- uiDefButBitS(block, TOG, OB_DUPLINOSPEED, REDRAWVIEW3D, "No Speed", 234,128,82,19, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame");
+
+ uiDefButBitS(block, TOG, OB_DUPLIFRAMES, REDRAWVIEW3D, "DupliFrames", 24,130,89,20, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
+ uiDefButBitS(block, TOG, OB_DUPLIVERTS, REDRAWVIEW3D, "DupliVerts", 114,130,82,20, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices");
+ uiDefButBitS(block, TOG, OB_DUPLIROT, REDRAWVIEW3D, "Rot", 200,130,31,20, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal");
+ uiDefButBitS(block, TOG, OB_DUPLINOSPEED, REDRAWVIEW3D, "No Speed", 234,130,82,20, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame");
+
+ uiDefButBitS(block, TOG, OB_DUPLIGROUP, REDRAWVIEW3D, "DupliGroup", 24,110,150,20, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
+ uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, REDRAWVIEW3D, "GR:", 174,110,142,20, &ob->dup_group, "Duplicate this entire Group");
+
uiBlockBeginAlign(block);
- uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:", 24,105,141,19, &ob->dupsta, 1.0, (MAXFRAMEF - 1.0f), 0, 0, "Specify startframe for Dupliframes");
- uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:", 170,105,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, "");
- uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd", 24,82,140,19, &ob->dupend, 1.0, MAXFRAMEF, 0, 0, "Specify endframe for Dupliframes");
- uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff", 171,82,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "");
+ uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:", 24,85,141,19, &ob->dupsta, 1.0, (MAXFRAMEF - 1.0f), 0, 0, "Specify startframe for Dupliframes");
+ uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:", 170,85,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, "");
+ uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd", 24,65,140,19, &ob->dupend, 1.0, MAXFRAMEF, 0, 0, "Specify endframe for Dupliframes");
+ uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff", 171,65,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "");
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "Offs Ob", 24,51,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo");
- uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "Offs Par", 82,51,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
- uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,51,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
+ uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "Offs Ob", 24,35,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo");
+ uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "Offs Par", 82,35,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
+ uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,35,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,17,115,30, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify an offset in frames");
- uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 139,17,104,31, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames");
- uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 248,17,67,31, 0, 0, 0, 0, 0, "Print objectspeed");
+ uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,10,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify an offset in frames");
+ uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 139,10,104,20, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames");
+ uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 248,10,67,20, 0, 0, 0, 0, 0, "Print objectspeed");
uiBlockEndAlign(block);
sprintf(str, "%.4f", prspeed);
- uiDefBut(block, LABEL, 0, str, 247,40,63,31, NULL, 1.0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, str, 247,35,63,31, NULL, 1.0, 0, 0, 0, "");
+
+}
+
+static void object_panel_draw(Object *ob)
+{
+ uiBlock *block;
+ int xco, a, dx, dy;
+
+ block= uiNewBlock(&curarea->uiblocks, "object_panel_draw", UI_EMBOSS, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Draw", "Object", 640, 0, 318, 204)==0) return;
+
+ /* LAYERS */
+ xco= 120;
+ dx= 35;
+ dy= 30;
+
+ uiDefBut(block, LABEL, 0, "Layers", 10,170,100,20, NULL, 0, 0, 0, 0, "");
+
+ uiBlockBeginAlign(block);
+ for(a=0; a<5; a++)
+ uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
+ for(a=0; a<5; a++)
+ uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
+
+ xco+= 7;
+ uiBlockBeginAlign(block);
+ for(a=5; a<10; a++)
+ uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
+ for(a=5; a<10; a++)
+ uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
+
+ uiBlockEndAlign(block);
+
+ uiDefBut(block, LABEL, 0, "Drawtype", 10,120,100,20, NULL, 0, 0, 0, 0, "");
+
+ uiBlockBeginAlign(block);
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Shaded", 10,100,100, 20, &ob->dt, 0, OB_SHADED, 0, 0, "Draw active object shaded or textured");
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Solid", 10,80,100, 20, &ob->dt, 0, OB_SOLID, 0, 0, "Draw active object in solid");
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Wire", 10,60, 100, 20, &ob->dt, 0, OB_WIRE, 0, 0, "Draw active object in wireframe");
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Bounds", 10,40, 100, 20, &ob->dt, 0, OB_BOUNDBOX, 0, 0, "Only draw object with bounding box");
+ uiBlockEndAlign(block);
+
+ uiDefBut(block, LABEL, 0, "Draw Extra", 120,120,90,20, NULL, 0, 0, 0, 0, "");
+
+ uiBlockBeginAlign(block);
+ uiDefButBitC(block, TOG, OB_BOUNDBOX, REDRAWVIEW3D, "Bounds", 120, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's bounds");
+ uiDefButBitC(block, TOG, OB_DRAWNAME, REDRAWVIEW3D, "Name", 210, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's name");
+
+ uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder%x4",
+ 120, 80, 90, 20, &ob->boundtype, 0, 0, 0, 0, "Selects the boundary display type");
+ uiDefButBitC(block, TOG, OB_AXIS, REDRAWVIEW3D, "Axis", 210, 80, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's centre and axis");
+
+ uiDefButBitC(block, TOG, OB_TEXSPACE, REDRAWVIEW3D, "TexSpace", 120, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's texture space");
+ uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 210, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Adds the active object's wireframe over solid drawing");
+
+ uiDefButBitC(block, TOG, OB_DRAWTRANSP, REDRAWVIEW3D, "Transp", 120, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Enables transparent materials for the active object (Mesh only)");
+ uiDefButBitC(block, TOG, OB_DRAWXRAY, REDRAWVIEW3D, "X-ray", 210, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Makes the active object draw in front of others");
}
+void object_panel_constraint(char *context)
+{
+ uiBlock *block;
+ Object *ob= OBACT;
+ ListBase *conlist;
+ bConstraint *curcon;
+ short xco, yco;
+ char str[64];
+
+ block= uiNewBlock(&curarea->uiblocks, "object_panel_constraint", UI_EMBOSS, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Constraints", context, 960, 0, 318, 204)==0) return;
+
+ /* this is a variable height panel, newpanel doesnt force new size on existing panels */
+ /* so first we make it default height */
+ uiNewPanelHeight(block, 204);
+
+ if(G.obedit==OBACT) return; // ??
+
+ conlist = get_active_constraints(OBACT);
+
+ if (conlist) {
+
+ uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint", 0, 190, 130, 20, "Add a new constraint");
+
+ /* print active object or bone */
+ str[0]= 0;
+ if (ob->flag & OB_POSEMODE){
+ bPoseChannel *pchan= get_active_posechannel(ob);
+ if(pchan) sprintf(str, "To Bone: %s", pchan->name);
+ }
+ else {
+ sprintf(str, "To Object: %s", ob->id.name+2);
+ }
+ uiDefBut(block, LABEL, 1, str, 150, 190, 150, 20, NULL, 0.0, 0.0, 0, 0, "Displays Active Object or Bone name");
+
+ /* Go through the list of constraints and draw them */
+ xco = 10;
+ yco = 160;
+
+ for (curcon = conlist->first; curcon; curcon=curcon->next) {
+ /* hrms, the temporal constraint should not draw! */
+ if(curcon->type==CONSTRAINT_TYPE_KINEMATIC) {
+ bKinematicConstraint *data= curcon->data;
+ if(data->flag & CONSTRAINT_IK_TEMP)
+ continue;
+ }
+ /* Draw default constraint header */
+ draw_constraint(block, conlist, curcon, &xco, &yco);
+ }
+
+ if(yco < 0) uiNewPanelHeight(block, 204-yco);
+
+ }
+}
+
void do_effects_panels(unsigned short event)
{
Object *ob;
@@ -1961,6 +2057,8 @@ static void object_panel_particles_motion(Object *ob)
uiDefButS(block, NUM, B_CALCEFFECT, "Tex:", 75,10,75,20, &paf->timetex, 1.0, 10.0, 0, 0, "Specify texture used for the texture emission");
/* right collumn */
+ uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_CALCEFFECT, "GR:", 160, 155, 150, 20, &paf->group, "Limit Force Fields to this Group");
+
uiBlockBeginAlign(block);
uiDefBut(block, LABEL, 0, "Force:", 160,130,75,20, NULL, 0.0, 0, 0, 0, "");
uiDefButF(block, NUM, B_CALCEFFECT, "X:", 235,130,75,20, paf->force, -1.0, 1.0, 1, 2, "Specify the X axis of a continues force");
@@ -2235,6 +2333,7 @@ void object_panels()
if(ob) {
if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ object_panel_object(ob);
object_panel_anim(ob);
object_panel_draw(ob);
object_panel_constraint("Object");
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 3b31009858f..d8121fd458f 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -3181,6 +3181,8 @@ static void material_panel_shading(Material *ma)
uiDefButBitI(block, TOG, MA_RAYBIAS, 0, "Bias", 245,80,65,19, &(ma->mode), 0, 0, 0, 0, "Prevents ray traced shadow errors with phong interpolated normals (terminator problem)");
uiBlockEndAlign(block);
+ uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_NOP, "GR:", 9, 55, 150, 19, &ma->group, "Limit Lighting to Lamps in this Group");
+
uiDefButBitI(block, TOG, MA_RADIO, 0, "Radio", 245,55,65,19, &(ma->mode), 0, 0, 0, 0, "Enables material for radiosity rendering");
}
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 3261c884ca6..92154d83348 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -222,7 +222,7 @@ static unsigned int colortab[24]=
{0x0, 0xFF88FF, 0xFFBBFF,
0x403000, 0xFFFF88, 0xFFFFBB,
0x104040, 0x66CCCC, 0x77CCCC,
- 0x101040, 0x5588FF, 0x88BBFF,
+ 0x104010, 0x55BB55, 0x66FF66,
0xFFFFFF
};
@@ -3604,9 +3604,19 @@ void draw_object(Base *base, int flag)
else colindex = 3;
}
else if(warning_recursive==1) {
- if(base->flag & (SELECT+BA_WAS_SEL)) colindex = 7;
+ if(base->flag & (SELECT+BA_WAS_SEL)) {
+ if(G.scene->basact==base) colindex = 8;
+ else colindex= 7;
+ }
else colindex = 6;
}
+ else if(ob->flag & OB_FROMGROUP) {
+ if(base->flag & (SELECT+BA_WAS_SEL)) {
+ if(G.scene->basact==base) colindex = 11;
+ else colindex= 10;
+ }
+ else colindex = 9;
+ }
}
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index d4654dd6718..04439c48f88 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -1702,6 +1702,7 @@ void do_viewbuts(unsigned short event)
DAG_scene_sort(G.scene);
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
allqueue(REDRAWVIEW3D, 1);
+ allqueue(REDRAWBUTSOBJECT, 0);
}
}
break;
diff --git a/source/blender/src/editgroup.c b/source/blender/src/editgroup.c
index f55f07986a4..07b3258b776 100644
--- a/source/blender/src/editgroup.c
+++ b/source/blender/src/editgroup.c
@@ -58,61 +58,16 @@
#include <config.h>
#endif
-void set_active_group(void)
+void add_selected_to_group(Group *group)
{
- /* with active object, find active group */
- Group *group;
- GroupObject *go;
-
- G.scene->group= NULL;
+ Base *base;
- if(BASACT) {
- group= G.main->group.first;
- while(group) {
- go= group->gobject.first;
- while(go) {
- if(go->ob == OBACT) {
- G.scene->group= group;
- return;
- }
- go= go->next;
- }
- group= group->id.next;
- }
- }
-}
-
-
-void add_selected_to_group(void)
-{
- Base *base= FIRSTBASE;
- Group *group;
-
- if(BASACT==NULL) {
- error("No active object");
- return;
- }
-
- if(okee("Add selected to group")==0) return;
-
- if(G.scene->group==NULL) G.scene->group= add_group();
-
- while(base) {
+ for(base=FIRSTBASE; base; base= base->next) {
if TESTBASE(base) {
-
- /* each object only in one group */
- group= find_group(base->object);
- if(group==G.scene->group);
- else {
- if(group) {
- rem_from_group(group, base->object);
- }
- add_to_group(G.scene->group, base->object);
- base->object->flag |= OB_FROMGROUP;
- base->flag |= OB_FROMGROUP;
- }
+ add_to_group(group, base->object);
+ base->object->flag |= OB_FROMGROUP;
+ base->flag |= OB_FROMGROUP;
}
- base= base->next;
}
allqueue(REDRAWVIEW3D, 0);
@@ -121,52 +76,46 @@ void add_selected_to_group(void)
void rem_selected_from_group(void)
{
- Base *base=FIRSTBASE;
+ Base *base;
Group *group;
- if(okee("Remove selected from group")==0) return;
-
- while(base) {
+ for(base=FIRSTBASE; base; base= base->next) {
if TESTBASE(base) {
- group= find_group(base->object);
- if(group) {
+ while( (group = find_group(base->object)) ) {
rem_from_group(group, base->object);
-
- base->object->flag &= ~OB_FROMGROUP;
- base->flag &= ~OB_FROMGROUP;
}
+ base->object->flag &= ~OB_FROMGROUP;
+ base->flag &= ~OB_FROMGROUP;
}
- base= base->next;
}
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSOBJECT, 0);
}
-void prev_group_key(Group *group)
+void group_operation_with_menu(void)
{
- GroupKey *gk= group->active;
-
- if(gk) gk= gk->prev;
-
- if(gk==NULL) group->active= group->gkey.last;
- else group->active= gk;
-
- set_group_key(group);
-}
-
-void next_group_key(Group *group)
-{
- GroupKey *gk= group->active;
-
- if(gk) gk= gk->next;
+ Base *base;
+ Group *group= NULL;
+ int mode;
- if(gk==NULL) group->active= group->gkey.first;
- else group->active= gk;
+ for(base=FIRSTBASE; base; base= base->next) {
+ if TESTBASE(base) {
+ group= find_group(base->object);
+ if(group) break;
+ }
+ }
- set_group_key(group);
+ if(base)
+ mode= pupmenu("Groups %t|Add to current Group %x3|Add to New Group %x1|Remove from all Groups %x2");
+ else
+ mode= pupmenu("Groups %t|Add to New Group %x1|Remove from all Groups %x2");
-}
-
-
+ if(mode>0) {
+ if(group==NULL) group= add_group();
+
+ if(mode==1 || mode==3) add_selected_to_group(group);
+ else if(mode==2) rem_selected_from_group();
+ }
+} \ No newline at end of file
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 34a6e2cfc69..c50597605d7 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -2352,7 +2352,6 @@ void common_insertkey(void)
else if(ob->type==OB_LATTICE) strcat(menustr, "| %x6|Lattice%x7");
else if(ob->type==OB_CURVE) strcat(menustr, "| %x6|Curve%x7");
else if(ob->type==OB_SURF) strcat(menustr, "| %x6|Surface%x7");
- if(ob->flag & OB_FROMGROUP) strcat(menustr, "| %x6|Entire Group%x10");
}
event= pupmenu(menustr);
@@ -2363,14 +2362,6 @@ void common_insertkey(void)
return;
}
- if(event==10) {
- Group *group= find_group(ob);
- if(group) {
- add_group_key(group);
- allqueue(REDRAWBUTSOBJECT, 0);
- }
- }
-
if (ob && (ob->flag & OB_POSEMODE)){
bPoseChannel *pchan;
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index da8dfc1d11b..894f787a2d2 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -62,6 +62,7 @@
#include "DNA_constraint_types.h"
#include "DNA_curve_types.h"
#include "DNA_effect_types.h"
+#include "DNA_group_types.h"
#include "DNA_image_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
@@ -102,6 +103,7 @@
#include "BKE_effect.h"
#include "BKE_font.h"
#include "BKE_global.h"
+#include "BKE_group.h"
#include "BKE_ipo.h"
#include "BKE_key.h"
#include "BKE_lattice.h"
@@ -4184,6 +4186,7 @@ static void adduplicate__forwardModifierLinks(void *userData, Object *ob, Object
{
ID_NEW(*obpoin);
}
+
void adduplicate(int noTrans)
/* dtrans is 3 x 3xfloat dloc, drot en dsize */
{
@@ -4219,7 +4222,14 @@ void adduplicate(int noTrans)
BLI_addhead(&G.scene->base, basen); /* addhead: prevent eternal loop */
basen->object= obn;
base->flag &= ~SELECT;
- basen->flag &= ~OB_FROMGROUP;
+
+ if(basen->flag & OB_FROMGROUP) {
+ Group *group;
+ for(group= G.main->group.first; group; group= group->id.next) {
+ if(object_in_group(ob, group))
+ add_to_group(group, obn);
+ }
+ }
if(BASACT==base) BASACT= basen;
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index 2376fe93619..458be9a0897 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -46,10 +46,11 @@
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_mesh_types.h"
#include "DNA_curve_types.h"
+#include "DNA_group_types.h"
#include "DNA_lattice_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
@@ -63,7 +64,9 @@
#include "BKE_armature.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
+#include "BKE_group.h"
#include "BKE_lattice.h"
+#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_utildefines.h"
@@ -1034,8 +1037,6 @@ void set_active_base(Base *base)
if(base) {
/* signals to buttons */
redraw_test_buttons(base->object);
-
- set_active_group();
/* signal to ipo */
allqueue(REDRAWIPO, base->object->ipowin);
@@ -1069,6 +1070,29 @@ void set_active_object(Object *ob)
}
}
+static void select_all_from_groups(Base *basact)
+{
+ Group *group;
+ GroupObject *go;
+ int deselect= basact->flag & SELECT;
+
+ for(group= G.main->group.first; group; group= group->id.next) {
+ if(object_in_group(basact->object, group)) {
+ for(go= group->gobject.first; go; go= go->next) {
+ if(deselect) go->ob->flag &= ~SELECT;
+ else go->ob->flag |= SELECT;
+ }
+ }
+ }
+ /* sync bases */
+ for(basact= G.scene->base.first; basact; basact= basact->next) {
+ if(basact->object->flag & SELECT)
+ basact->flag |= SELECT;
+ else
+ basact->flag &= ~SELECT;
+ }
+}
+
/* The max number of menu items in an object select menu */
#define SEL_MENU_SIZE 22
@@ -1342,6 +1366,9 @@ void mouse_select(void)
deselectall_except(basact);
basact->flag |= SELECT;
}
+ else if(G.qual==(LR_SHIFTKEY|LR_ALTKEY)) {
+ select_all_from_groups(basact);
+ }
else {
if(basact->flag & SELECT) {
if(basact==oldbasact)
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index 3b17f0c2c26..db4c981eba2 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -2534,7 +2534,7 @@ void main_to_filelist(SpaceFile *sfile)
if( sfile->dir[0]==0) {
/* make directories */
- sfile->totfile= 21;
+ sfile->totfile= 22;
sfile->filelist= (struct direntry *)malloc(sfile->totfile * sizeof(struct direntry));
for(a=0; a<sfile->totfile; a++) {
@@ -2545,24 +2545,25 @@ void main_to_filelist(SpaceFile *sfile)
sfile->filelist[0].relname= BLI_strdup("..");
sfile->filelist[1].relname= BLI_strdup(".");
sfile->filelist[2].relname= BLI_strdup("Scene");
- sfile->filelist[3].relname= BLI_strdup("Object");
- sfile->filelist[4].relname= BLI_strdup("Mesh");
- sfile->filelist[5].relname= BLI_strdup("Curve");
- sfile->filelist[6].relname= BLI_strdup("Metaball");
- sfile->filelist[7].relname= BLI_strdup("Material");
- sfile->filelist[8].relname= BLI_strdup("Texture");
- sfile->filelist[9].relname= BLI_strdup("Image");
- sfile->filelist[10].relname= BLI_strdup("Wave");
- sfile->filelist[11].relname= BLI_strdup("Lattice");
- sfile->filelist[12].relname= BLI_strdup("Lamp");
- sfile->filelist[13].relname= BLI_strdup("Camera");
- sfile->filelist[14].relname= BLI_strdup("Ipo");
- sfile->filelist[15].relname= BLI_strdup("World");
- sfile->filelist[16].relname= BLI_strdup("Screen");
- sfile->filelist[17].relname= BLI_strdup("VFont");
- sfile->filelist[18].relname= BLI_strdup("Text");
- sfile->filelist[19].relname= BLI_strdup("Armature");
- sfile->filelist[20].relname= BLI_strdup("Action");
+ sfile->filelist[3].relname= BLI_strdup("Group");
+ sfile->filelist[4].relname= BLI_strdup("Object");
+ sfile->filelist[5].relname= BLI_strdup("Mesh");
+ sfile->filelist[6].relname= BLI_strdup("Curve");
+ sfile->filelist[7].relname= BLI_strdup("Metaball");
+ sfile->filelist[8].relname= BLI_strdup("Material");
+ sfile->filelist[9].relname= BLI_strdup("Texture");
+ sfile->filelist[10].relname= BLI_strdup("Image");
+ sfile->filelist[11].relname= BLI_strdup("Wave");
+ sfile->filelist[12].relname= BLI_strdup("Lattice");
+ sfile->filelist[13].relname= BLI_strdup("Lamp");
+ sfile->filelist[14].relname= BLI_strdup("Camera");
+ sfile->filelist[15].relname= BLI_strdup("Ipo");
+ sfile->filelist[16].relname= BLI_strdup("World");
+ sfile->filelist[17].relname= BLI_strdup("Screen");
+ sfile->filelist[18].relname= BLI_strdup("VFont");
+ sfile->filelist[19].relname= BLI_strdup("Text");
+ sfile->filelist[20].relname= BLI_strdup("Armature");
+ sfile->filelist[21].relname= BLI_strdup("Action");
qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_name);
}
else {
diff --git a/source/blender/src/header_oops.c b/source/blender/src/header_oops.c
index 1da5dc6100f..a8f90b95ed8 100644
--- a/source/blender/src/header_oops.c
+++ b/source/blender/src/header_oops.c
@@ -1,20 +1,12 @@
/**
- * header_oops.c oct-2003
- *
- * Functions to draw the "OOPS Schematic" window header
- * and handle user events sent to it.
- *
* $Id$
*
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ * ***** 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. 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.
+ * 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
@@ -28,11 +20,11 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * The Original Code is: all of this file.
+ * The Original Code is: not all of this file anymore.
*
- * Contributor(s): none yet.
+ * Contributor(s): Blender Foundation.
*
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * ***** END GPL LICENSE BLOCK *****
*/
#include <stdlib.h>
@@ -440,7 +432,7 @@ void oops_buttons(void)
}
#endif
else {
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
+ uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
}
/* always do as last */
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index 2b448348034..fbea7637dd1 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -742,7 +742,7 @@ void do_view3d_select_object_groupedmenu(void *arg, int event)
case 2: /* Immediate Children */
case 3: /* Parent */
case 4: /* Objects on Shared Layers */
- select_group((short)event);
+ select_grouped((short)event);
break;
}
allqueue(REDRAWVIEW3D, 0);
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c
index 76ab56fb574..c4c11a4c294 100644
--- a/source/blender/src/outliner.c
+++ b/source/blender/src/outliner.c
@@ -39,6 +39,7 @@
#include "DNA_camera_types.h"
#include "DNA_image_types.h"
#include "DNA_ipo_types.h"
+#include "DNA_group_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
@@ -65,6 +66,7 @@
#include "BKE_material.h"
#include "BKE_modifier.h"
#include "BKE_screen.h"
+#include "BKE_scene.h"
#include "BKE_utildefines.h"
#include "BIF_butspace.h"
@@ -768,6 +770,23 @@ static void outliner_build_tree(SpaceOops *soops)
}
outliner_make_hierarchy(soops, &soops->tree);
}
+ else if(soops->outlinevis == SO_GROUPS) {
+ Group *group;
+ GroupObject *go;
+
+ for(group= G.main->group.first; group; group= group->id.next) {
+ te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0);
+ tselem= TREESTORE(te);
+
+ for(go= group->gobject.first; go; go= go->next) {
+ ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0);
+ ten->directdata= NULL;
+ }
+ outliner_make_hierarchy(soops, &te->subtree);
+ /* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
+ for(go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL;
+ }
+ }
else if(soops->outlinevis == SO_SAME_TYPE) {
Object *ob= OBACT;
if(ob) {
@@ -1794,22 +1813,29 @@ static void object_select_cb(TreeElement *te, TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
- base->flag |= SELECT;
- base->object->flag |= SELECT;
+ if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
+ if(base) {
+ base->flag |= SELECT;
+ base->object->flag |= SELECT;
+ }
}
static void object_deselect_cb(TreeElement *te, TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
- base->flag &= ~SELECT;
- base->object->flag &= ~SELECT;
+ if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
+ if(base) {
+ base->flag &= ~SELECT;
+ base->object->flag &= ~SELECT;
+ }
}
static void object_delete_cb(TreeElement *te, TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
+ if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
if(base) {
// check also library later
if(G.obedit==base->object) exit_editmode(2);
@@ -2121,6 +2147,8 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
BIF_draw_icon(x, y, ICON_NLA); break;
case ID_TXT:
BIF_draw_icon(x, y, ICON_SCRIPT); break;
+ case ID_GR:
+ BIF_draw_icon(x, y, ICON_CIRCLE_DEHLT); break;
}
}
}
diff --git a/source/blender/src/previewrender.c b/source/blender/src/previewrender.c
index 8604219387f..3667b170270 100644
--- a/source/blender/src/previewrender.c
+++ b/source/blender/src/previewrender.c
@@ -54,6 +54,7 @@
#include "render.h"
#include "mydevice.h"
+#include "DNA_group_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
#include "DNA_camera_types.h"
@@ -1186,9 +1187,9 @@ void BIF_previewrender(SpaceButs *sbuts)
init_render_world();
preview_init_render_textures(la->mtex);
- R.totlamp= 0;
+
RE_add_render_lamp(ob, 0); /* 0=no shadbuf or tables */
- lar= R.la[0];
+ lar= ((GroupObject *)R.lights.first)->lampren;
/* exceptions: */
lar->spottexfac= 1.0f;
@@ -1361,11 +1362,10 @@ void BIF_previewrender(SpaceButs *sbuts)
uiPanelPop(block);
- if(la) {
- if(R.totlamp) {
- MEM_freeN(R.la[0]);
- }
- R.totlamp= 0;
+ if(lar) {
+ MEM_freeN(lar);
+ MEM_freeN(R.lights.first);
+ R.lights.first= R.lights.last= NULL;
}
}
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 73552449fba..32c1feb9718 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -577,31 +577,10 @@ static void select_parent(void) /* Makes parent active and de-selected OBACT */
}
}
-
-void select_group_menu(void)
-{
- char *str;
- short nr;
-
- /* make menu string */
-
- str= MEM_mallocN(160, "groupmenu");
- strcpy(str, "Select Grouped%t|Children%x1|"
- "Immediate Children%x2|Parent%x3|"
- "Objects on Shared Layers%x4");
-
- /* here we go */
-
- nr= pupmenu(str);
- MEM_freeN(str);
-
- select_group(nr);
-}
-
-void select_group(short nr)
+void select_grouped(short nr)
{
Base *base;
-
+
if(nr==4) {
base= FIRSTBASE;
while(base) {
@@ -623,6 +602,27 @@ void select_group(short nr)
allqueue(REDRAWIPO, 0);
}
+static void select_grouped_menu(void)
+{
+ char *str;
+ short nr;
+
+ /* make menu string */
+
+ str= MEM_mallocN(160, "groupmenu");
+ strcpy(str, "Select Grouped%t|Children%x1|"
+ "Immediate Children%x2|Parent%x3|"
+ "Objects on Shared Layers%x4");
+
+ /* here we go */
+
+ nr= pupmenu(str);
+ MEM_freeN(str);
+
+ select_grouped(nr);
+}
+
+
static unsigned short convert_for_nonumpad(unsigned short event)
{
if (event>=ZEROKEY && event<=NINEKEY) {
@@ -1262,10 +1262,9 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case GKEY:
- /* RMGRP if(G.qual & LR_CTRLKEY) add_selected_to_group();
- else if(G.qual & LR_ALTKEY) rem_selected_from_group(); */
- if((G.qual==LR_SHIFTKEY))
- select_group_menu();
+ if(G.qual & LR_CTRLKEY) group_operation_with_menu();
+ else if((G.qual==LR_SHIFTKEY))
+ select_grouped_menu();
else if(G.qual==LR_ALTKEY) {
if(okee("Clear location")) {
clear_object('g');