merge with 2.5 at revision 18432, made bmesh compile, and also made msvc use incremental linking under scons

This commit is contained in:
Joseph Eagar 2009-01-09 18:32:33 +00:00
commit dbe6735ae5
110 changed files with 8048 additions and 941 deletions

@ -180,7 +180,7 @@ CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/ENTRY:mainCRTStartup','/INCREMENTAL:NO','/NODEFAULTLIB:"msvcprt.lib"','/NODEFAULTLIB:"glut32.lib"','/NODEFAULTLIB:"libc.lib"','/NODEFAULTLIB:"libcd.lib"','/NODEFAULTLIB:"libcpd.lib"','/NODEFAULTLIB:"libcp.lib"','/LARGEADDRESSAWARE']
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/ENTRY:mainCRTStartup','/INCREMENTAL:YES','/NODEFAULTLIB:"msvcprt.lib"','/NODEFAULTLIB:"glut32.lib"','/NODEFAULTLIB:"libc.lib"','/NODEFAULTLIB:"libcd.lib"','/NODEFAULTLIB:"libcpd.lib"','/NODEFAULTLIB:"libcp.lib"','/LARGEADDRESSAWARE']
# # Todo
# BF_PROFILE_CCFLAGS = ['-pg', '-g ']

@ -38,7 +38,7 @@ TESTDIRS = test
include nan_subdirs.mk
install: all
install: all debug
@[ -d $(NAN_GHOST) ] || mkdir $(NAN_GHOST)
@[ -d $(NAN_GHOST)/include ] || mkdir $(NAN_GHOST)/include
@[ -d $(NAN_GHOST)/lib ] || mkdir $(NAN_GHOST)/lib

@ -517,6 +517,14 @@
RelativePath="..\..\..\source\blender\blenkernel\intern\bmfont.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\blenkernel\intern\booleanops.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\blenkernel\intern\booleanops_mesh.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\blenkernel\intern\brush.c"
>

@ -342,6 +342,10 @@
RelativePath="..\..\..\source\blender\editors\interface\interface_regions.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\interface\keyval.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\interface\resources.c"
>
@ -406,6 +410,10 @@
RelativePath="..\..\..\source\blender\editors\space_view3d\view3d_view.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\space_view3d\vpaint.c"
>
</File>
</Filter>
<Filter
Name="space_time"
@ -478,6 +486,10 @@
RelativePath="..\..\..\source\blender\editors\screen\screen_ops.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\screen\screendump.c"
>
</File>
</Filter>
<Filter
Name="util"
@ -902,6 +914,10 @@
<Filter
Name="mesh"
>
<File
RelativePath="..\..\..\source\blender\editors\mesh\editdeform.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\mesh\editface.c"
>

@ -708,6 +708,10 @@
RelativePath="..\..\..\source\blender\makesrna\intern\rna_particle.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna_pose.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna_property.c"
>

@ -167,7 +167,179 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.c"
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_action_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_actuator_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_armature_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_brush_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_camera_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_cloth_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_color_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_constraint_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_controller_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_curve_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_fluidsim_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_group_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_ID_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_image_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_ipo_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_key_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_lamp_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_lattice_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_main_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_material_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_mesh_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_meta_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_modifier_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_nodetree_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_object_force_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_object_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_packedfile_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_particle_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_pose_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_property_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_radio_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_rna_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_scene_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_screen_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_scriptlink_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_sensor_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_sequence_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_sound_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_text_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_texture_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_userdef_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_vfont_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_wm_gen.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_world_gen.c"
>
</File>
<File

@ -237,8 +237,8 @@ PULIB += $(OCGDIR)/blender/ed_time/libed_time.a
PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a
PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
PULIB += $(OCGDIR)/blender/ed_object/libed_object.a
PULIB += $(OCGDIR)/blender/ed_mesh/libed_mesh.a
PULIB += $(OCGDIR)/blender/ed_armature/libed_armature.a
PULIB += $(OCGDIR)/blender/ed_mesh/libed_mesh.a
PULIB += $(OCGDIR)/blender/ed_animation/libed_animation.a
PULIB += $(OCGDIR)/blender/ed_transform/libed_transform.a
PULIB += $(OCGDIR)/blender/ed_util/libed_util.a

@ -3,6 +3,7 @@ Import ('env')
import sys
SConscript(['avi/SConscript',
'bmesh/SConscript',
'blenkernel/SConscript',
'blenlib/SConscript',
'blenloader/SConscript',

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
@ -29,6 +29,7 @@
#ifndef BKE_BOOLEANOPS_H
#define BKE_BOOLEANOPS_H
struct Scene;
struct Object;
struct Base;
struct DerivedMesh;
@ -36,7 +37,7 @@ struct DerivedMesh;
/* Performs a boolean between two mesh objects, it is assumed that both objects
are in fact a mesh object. On success returns 1 and creates a new mesh object
into blender data structures. On failure returns 0 and reports an error. */
int NewBooleanMesh(struct Base *base, struct Base *base_select, int op);
int NewBooleanMesh(struct Scene *scene, struct Base *base, struct Base *base_select, int op);
/* Performs a boolean between two mesh objects, it is assumed that both objects

@ -47,9 +47,11 @@ struct Lattice *copy_lattice(struct Lattice *lt);
void free_lattice(struct Lattice *lt);
void make_local_lattice(struct Lattice *lt);
void calc_lat_fudu(int flag, int res, float *fu, float *du);
void init_latt_deform(struct Object *oblatt, struct Object *ob);
void calc_latt_deform(float *co, float weight);
void end_latt_deform(void);
void calc_latt_deform(struct Object *, float *co, float weight);
void end_latt_deform(struct Object *);
int object_deform_mball(struct Object *ob);
void outside_lattice(struct Lattice *lt);

@ -115,6 +115,9 @@ typedef struct ARegionType {
/* return context data */
int (*context)(const struct bContext *, const void *, struct bContextDataResult *);
/* custom drawing callbacks */
ListBase drawcalls;
/* hardcoded constraints, smaller than these values region is not visible */
int minsizex, minsizey;
/* default keymaps to add */

@ -33,6 +33,7 @@ SET(INC
../../../intern/iksolver/extern ../blenloader ../quicktime
../../../intern/bmfont ../../../extern/bullet2/src
../nodes ../../../extern/glew/include ../gpu ../makesrna
../../../intern/bsp/extern
${SDL_INC}
${ZLIB_INC}
)

@ -9,7 +9,7 @@ incs += ' ../imbuf ../avi #/intern/elbeem/extern ../nodes'
incs += ' #/intern/iksolver/extern ../blenloader'
incs += ' #/extern/bullet2/src'
incs += ' #/intern/bmfont'
incs += ' #/intern/opennl/extern'
incs += ' #/intern/opennl/extern #/intern/bsp/extern'
incs += ' ../gpu #/extern/glew/include'
incs += ' ' + env['BF_OPENGL_INC']

@ -69,6 +69,7 @@ CPPFLAGS += -I$(NAN_IKSOLVER)/include
CPPFLAGS += -I$(NAN_DECIMATION)/include
CPPFLAGS += -I$(NAN_ELBEEM)/include
CPPFLAGS += -I$(NAN_OPENNL)/include
CPPFLAGS += -I$(NAN_BSP)/include
# path to zlib
CPPFLAGS += -I$(NAN_ZLIB)/include

@ -946,8 +946,8 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
MEM_freeN(obcopylist);
if(psys->lattice) {
end_latt_deform();
psys->lattice = 0;
end_latt_deform(psys->lattice);
psys->lattice = NULL;
}
}

@ -378,7 +378,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
/* last stage of do_versions actually, that sets recalc flags for recalc poses */
for(ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->type==OB_ARMATURE)
if(ob->recalc) object_handle_update(curscene, ob);
if(ob->recalc) object_handle_update(CTX_data_scene(C), ob);
}
/* now tag update flags, to ensure deformers get calculated on redraw */

@ -0,0 +1,567 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
* CSG operations.
*/
#include <string.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "CSG_BooleanOps.h"
#include "BKE_booleanops.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_utildefines.h"
/**
* Here's the vertex iterator structure used to walk through
* the blender vertex structure.
*/
typedef struct {
Mesh *mesh;
Object *ob;
int pos;
} VertexIt;
/**
* Implementations of local vertex iterator functions.
* These describe a blender mesh to the CSG module.
*/
static void VertexIt_Destruct(CSG_VertexIteratorDescriptor * iterator)
{
if (iterator->it) {
// deallocate memory for iterator
MEM_freeN(iterator->it);
iterator->it = 0;
}
iterator->Done = NULL;
iterator->Fill = NULL;
iterator->Reset = NULL;
iterator->Step = NULL;
iterator->num_elements = 0;
}
static int VertexIt_Done(CSG_IteratorPtr it)
{
VertexIt * iterator = (VertexIt *)it;
return(iterator->pos >= iterator->mesh->totvert);
}
static void VertexIt_Fill(CSG_IteratorPtr it, CSG_IVertex *vert)
{
VertexIt * iterator = (VertexIt *)it;
MVert *verts = iterator->mesh->mvert;
float global_pos[3];
/* boolean happens in global space, transform both with obmat */
VecMat4MulVecfl(
global_pos,
iterator->ob->obmat,
verts[iterator->pos].co
);
vert->position[0] = global_pos[0];
vert->position[1] = global_pos[1];
vert->position[2] = global_pos[2];
}
static void VertexIt_Step(CSG_IteratorPtr it)
{
VertexIt * iterator = (VertexIt *)it;
iterator->pos ++;
}
static void VertexIt_Reset(CSG_IteratorPtr it)
{
VertexIt * iterator = (VertexIt *)it;
iterator->pos = 0;
}
static void VertexIt_Construct(CSG_VertexIteratorDescriptor *output, Object *ob)
{
VertexIt *it;
if (output == 0) return;
// allocate some memory for blender iterator
it = (VertexIt *)(MEM_mallocN(sizeof(VertexIt),"Boolean_VIt"));
if (it == 0) {
return;
}
// assign blender specific variables
it->ob = ob;
it->mesh = ob->data;
it->pos = 0;
// assign iterator function pointers.
output->Step = VertexIt_Step;
output->Fill = VertexIt_Fill;
output->Done = VertexIt_Done;
output->Reset = VertexIt_Reset;
output->num_elements = it->mesh->totvert;
output->it = it;
}
/**
* Blender Face iterator
*/
typedef struct {
Mesh *mesh;
int pos;
int offset;
} FaceIt;
static void FaceIt_Destruct(CSG_FaceIteratorDescriptor * iterator)
{
MEM_freeN(iterator->it);
iterator->Done = NULL;
iterator->Fill = NULL;
iterator->Reset = NULL;
iterator->Step = NULL;
iterator->num_elements = 0;
}
static int FaceIt_Done(CSG_IteratorPtr it)
{
// assume CSG_IteratorPtr is of the correct type.
FaceIt * iterator = (FaceIt *)it;
return(iterator->pos >= iterator->mesh->totface);
}
static void FaceIt_Fill(CSG_IteratorPtr it, CSG_IFace *face)
{
// assume CSG_IteratorPtr is of the correct type.
FaceIt *face_it = (FaceIt *)it;
MFace *mfaces = face_it->mesh->mface;
MFace *mface = &mfaces[face_it->pos];
face->vertex_index[0] = mface->v1;
face->vertex_index[1] = mface->v2;
face->vertex_index[2] = mface->v3;
if (mface->v4) {
face->vertex_index[3] = mface->v4;
face->vertex_number = 4;
} else {
face->vertex_number = 3;
}
face->orig_face = face_it->offset + face_it->pos;
}
static void FaceIt_Step(CSG_IteratorPtr it)
{
FaceIt * face_it = (FaceIt *)it;
face_it->pos ++;
}
static void FaceIt_Reset(CSG_IteratorPtr it)
{
FaceIt * face_it = (FaceIt *)it;
face_it->pos = 0;
}
static void FaceIt_Construct(
CSG_FaceIteratorDescriptor *output, Object *ob, int offset)
{
FaceIt *it;
if (output == 0) return;
// allocate some memory for blender iterator
it = (FaceIt *)(MEM_mallocN(sizeof(FaceIt),"Boolean_FIt"));
if (it == 0) {
return ;
}
// assign blender specific variables
it->mesh = ob->data;
it->offset = offset;
it->pos = 0;
// assign iterator function pointers.
output->Step = FaceIt_Step;
output->Fill = FaceIt_Fill;
output->Done = FaceIt_Done;
output->Reset = FaceIt_Reset;
output->num_elements = it->mesh->totface;
output->it = it;
}
static Object *AddNewBlenderMesh(Scene *scene, Base *base)
{
// This little function adds a new mesh object to the blender object list
// It uses ob to duplicate data as this seems to be easier than creating
// a new one. This new oject contains no faces nor vertices.
Mesh *old_me;
Base *basen;
Object *ob_new;
// now create a new blender object.
// duplicating all the settings from the previous object
// to the new one.
ob_new= copy_object(base->object);
// Ok we don't want to use the actual data from the
// last object, the above function incremented the
// number of users, so decrement it here.
old_me= ob_new->data;
old_me->id.us--;
// Now create a new base to add into the linked list of
// vase objects.
basen= MEM_mallocN(sizeof(Base), "duplibase");
*basen= *base;
BLI_addhead(&scene->base, basen); /* addhead: anders oneindige lus */
basen->object= ob_new;
basen->flag &= ~SELECT;
// Initialize the mesh data associated with this object.
ob_new->data= add_mesh("Mesh");
G.totmesh++;
// Finally assign the object type.
ob_new->type= OB_MESH;
return ob_new;
}
static void InterpCSGFace(
DerivedMesh *dm, Mesh *orig_me, int index, int orig_index, int nr,
float mapmat[][4])
{
float obco[3], *co[4], *orig_co[4], w[4][4];
MFace *mface, *orig_mface;
int j;
mface = CDDM_get_face(dm, index);
orig_mface = orig_me->mface + orig_index;
// get the vertex coordinates from the original mesh
orig_co[0] = (orig_me->mvert + orig_mface->v1)->co;
orig_co[1] = (orig_me->mvert + orig_mface->v2)->co;
orig_co[2] = (orig_me->mvert + orig_mface->v3)->co;
orig_co[3] = (orig_mface->v4)? (orig_me->mvert + orig_mface->v4)->co: NULL;
// get the vertex coordinates from the new derivedmesh
co[0] = CDDM_get_vert(dm, mface->v1)->co;
co[1] = CDDM_get_vert(dm, mface->v2)->co;
co[2] = CDDM_get_vert(dm, mface->v3)->co;
co[3] = (nr == 4)? CDDM_get_vert(dm, mface->v4)->co: NULL;
for (j = 0; j < nr; j++) {
// get coordinate into the space of the original mesh
if (mapmat)
VecMat4MulVecfl(obco, mapmat, co[j]);
else
VecCopyf(obco, co[j]);
InterpWeightsQ3Dfl(orig_co[0], orig_co[1], orig_co[2], orig_co[3], obco, w[j]);
}
CustomData_interp(&orig_me->fdata, &dm->faceData, &orig_index, NULL, (float*)w, 1, index);
}
/* Iterate over the CSG Output Descriptors and create a new DerivedMesh
from them */
static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
CSG_FaceIteratorDescriptor *face_it,
CSG_VertexIteratorDescriptor *vertex_it,
float parinv[][4],
float mapmat[][4],
Material **mat,
int *totmat,
Object *ob1,
Object *ob2)
{
DerivedMesh *dm;
GHash *material_hash = NULL;
Mesh *me1= (Mesh*)ob1->data;
Mesh *me2= (Mesh*)ob2->data;
int i;
// create a new DerivedMesh
dm = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements);
CustomData_merge(&me1->fdata, &dm->faceData, CD_MASK_DERIVEDMESH,
CD_DEFAULT, face_it->num_elements);
CustomData_merge(&me2->fdata, &dm->faceData, CD_MASK_DERIVEDMESH,
CD_DEFAULT, face_it->num_elements);
// step through the vertex iterators:
for (i = 0; !vertex_it->Done(vertex_it->it); i++) {
CSG_IVertex csgvert;
MVert *mvert = CDDM_get_vert(dm, i);
// retrieve a csg vertex from the boolean module
vertex_it->Fill(vertex_it->it, &csgvert);
vertex_it->Step(vertex_it->it);
// we have to map the vertex coordinates back in the coordinate frame
// of the resulting object, since it was computed in world space
VecMat4MulVecfl(mvert->co, parinv, csgvert.position);
}
// a hash table to remap materials to indices
if (mat) {
material_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
*totmat = 0;
}
// step through the face iterators
for(i = 0; !face_it->Done(face_it->it); i++) {
Mesh *orig_me;
Object *orig_ob;
Material *orig_mat;
CSG_IFace csgface;
MFace *mface;
int orig_index, mat_nr;
// retrieve a csg face from the boolean module
face_it->Fill(face_it->it, &csgface);
face_it->Step(face_it->it);
// find the original mesh and data
orig_ob = (csgface.orig_face < me1->totface)? ob1: ob2;
orig_me = (orig_ob == ob1)? me1: me2;
orig_index = (orig_ob == ob1)? csgface.orig_face: csgface.orig_face - me1->totface;
// copy all face layers, including mface
CustomData_copy_data(&orig_me->fdata, &dm->faceData, orig_index, i, 1);
// set mface
mface = CDDM_get_face(dm, i);
mface->v1 = csgface.vertex_index[0];
mface->v2 = csgface.vertex_index[1];
mface->v3 = csgface.vertex_index[2];
mface->v4 = (csgface.vertex_number == 4)? csgface.vertex_index[3]: 0;
// set material, based on lookup in hash table
orig_mat= give_current_material(orig_ob, mface->mat_nr+1);
if (mat && orig_mat) {
if (!BLI_ghash_haskey(material_hash, orig_mat)) {
mat[*totmat] = orig_mat;
mat_nr = mface->mat_nr = (*totmat)++;
BLI_ghash_insert(material_hash, orig_mat, SET_INT_IN_POINTER(mat_nr));
}
else
mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat));
}
else
mface->mat_nr = 0;
InterpCSGFace(dm, orig_me, i, orig_index, csgface.vertex_number,
(orig_me == me2)? mapmat: NULL);
test_index_face(mface, &dm->faceData, i, csgface.vertex_number);
}
if (material_hash)
BLI_ghash_free(material_hash, NULL, NULL);
CDDM_calc_edges(dm);
CDDM_calc_normals(dm);
return dm;
}
static void BuildMeshDescriptors(
struct Object *ob,
int face_offset,
struct CSG_FaceIteratorDescriptor * face_it,
struct CSG_VertexIteratorDescriptor * vertex_it)
{
VertexIt_Construct(vertex_it,ob);
FaceIt_Construct(face_it,ob,face_offset);
}
static void FreeMeshDescriptors(
struct CSG_FaceIteratorDescriptor *face_it,
struct CSG_VertexIteratorDescriptor *vertex_it)
{
VertexIt_Destruct(vertex_it);
FaceIt_Destruct(face_it);
}
DerivedMesh *NewBooleanDerivedMesh_intern(
struct Object *ob, struct Object *ob_select,
int int_op_type, Material **mat, int *totmat)
{
float inv_mat[4][4];
float map_mat[4][4];
DerivedMesh *dm = NULL;
Mesh *me1 = get_mesh(ob_select);
Mesh *me2 = get_mesh(ob);
if (me1 == NULL || me2 == NULL) return 0;
if (!me1->totface || !me2->totface) return 0;
// we map the final object back into ob's local coordinate space. For this
// we need to compute the inverse transform from global to ob (inv_mat),
// and the transform from ob to ob_select for use in interpolation (map_mat)
Mat4Invert(inv_mat, ob->obmat);
Mat4MulMat4(map_mat, ob_select->obmat, inv_mat);
Mat4Invert(inv_mat, ob_select->obmat);
{
// interface with the boolean module:
//
// the idea is, we pass the boolean module verts and faces using the
// provided descriptors. once the boolean operation is performed, we
// get back output descriptors, from which we then build a DerivedMesh
CSG_VertexIteratorDescriptor vd_1, vd_2;
CSG_FaceIteratorDescriptor fd_1, fd_2;
CSG_OperationType op_type;
CSG_BooleanOperation *bool_op;
// work out the operation they chose and pick the appropriate
// enum from the csg module.
switch (int_op_type) {
case 1 : op_type = e_csg_intersection; break;
case 2 : op_type = e_csg_union; break;
case 3 : op_type = e_csg_difference; break;
case 4 : op_type = e_csg_classify; break;
default : op_type = e_csg_intersection;
}
BuildMeshDescriptors(ob_select, 0, &fd_1, &vd_1);
BuildMeshDescriptors(ob, me1->totface, &fd_2, &vd_2);
bool_op = CSG_NewBooleanFunction();
// perform the operation
if (CSG_PerformBooleanOperation(bool_op, op_type, fd_1, vd_1, fd_2, vd_2)) {
CSG_VertexIteratorDescriptor vd_o;
CSG_FaceIteratorDescriptor fd_o;
CSG_OutputFaceDescriptor(bool_op, &fd_o);
CSG_OutputVertexDescriptor(bool_op, &vd_o);
// iterate through results of operation and insert
// into new object
dm = ConvertCSGDescriptorsToDerivedMesh(
&fd_o, &vd_o, inv_mat, map_mat, mat, totmat, ob_select, ob);
// free up the memory
CSG_FreeVertexDescriptor(&vd_o);
CSG_FreeFaceDescriptor(&fd_o);
}
// else
// XXX error("Unknown internal error in boolean");
CSG_FreeBooleanOperation(bool_op);
FreeMeshDescriptors(&fd_1, &vd_1);
FreeMeshDescriptors(&fd_2, &vd_2);
}
return dm;
}
int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type)
{
Mesh *me_new;
int a, maxmat, totmat= 0;
Object *ob_new, *ob, *ob_select;
Material **mat;
DerivedMesh *dm;
ob= base->object;
ob_select= base_select->object;
maxmat= ob->totcol + ob_select->totcol;
mat= (Material**)MEM_mallocN(sizeof(Material*)*maxmat, "NewBooleanMeshMat");
/* put some checks in for nice user feedback */
if((!(get_mesh(ob)->totface)) || (!(get_mesh(ob_select)->totface)))
{
MEM_freeN(mat);
return -1;
}
dm= NewBooleanDerivedMesh_intern(ob, ob_select, int_op_type, mat, &totmat);
if (dm == NULL) {
MEM_freeN(mat);
return 0;
}
/* create a new blender mesh object - using 'base' as a template */
ob_new= AddNewBlenderMesh(scene, base_select);
me_new= ob_new->data;
DM_to_mesh(dm, me_new);
dm->release(dm);
/* add materials to object */
for (a = 0; a < totmat; a++)
assign_material(ob_new, mat[a], a+1);
MEM_freeN(mat);
/* update dag */
DAG_object_flush_update(scene, ob_new, OB_RECALC_DATA);
return 1;
}
DerivedMesh *NewBooleanDerivedMesh(struct Object *ob, struct Object *ob_select,
int int_op_type)
{
return NewBooleanDerivedMesh_intern(ob, ob_select, int_op_type, NULL, NULL);
}

@ -0,0 +1,293 @@
#if 0
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "CSG_BooleanOps.h"
#include "BKE_booleanops.h"
#include "BKE_booleanops_mesh.h"
#include "MEM_guardedalloc.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_displist.h"
#include "BKE_object.h"
#include "BKE_utildefines.h"
#include "BKE_library.h"
#include "BKE_material.h"
#include "BLI_arithb.h"
/**
* Implementation of boolean ops mesh interface.
*/
void
CSG_DestroyMeshDescriptor(
CSG_MeshDescriptor *mesh
){
// Call mesh descriptors destroy function....
mesh->m_destroy_func(mesh);
}
// Destroy function for blender mesh internals.
static
void
CSG_DestroyBlenderMeshInternals(
CSG_MeshDescriptor *mesh
) {
// Free face and vertex iterators.
FreeMeshDescriptors(&(mesh->m_face_iterator),&(mesh->m_vertex_iterator));
}
static
void
CSG_DestroyCSGMeshInternals(
CSG_MeshDescriptor *mesh
){
CSG_FreeVertexDescriptor(&(mesh->m_vertex_iterator));
CSG_FreeFaceDescriptor(&(mesh->m_face_iterator));
}
static
int
MakeCSGMeshFromBlenderBase(
Base * base,
CSG_MeshDescriptor * output
) {
Mesh *me;
if (output == NULL || base == NULL) return 0;
me = get_mesh(base->object);
output->m_descriptor.user_face_vertex_data_size = 0;
output->m_descriptor.user_data_size = sizeof(FaceData);
output->base = base;
BuildMeshDescriptors(
base->object,
&(output->m_face_iterator),
&(output->m_vertex_iterator)
);
output->m_destroy_func = CSG_DestroyBlenderMeshInternals;
return 1;
}
int
CSG_LoadBlenderMesh(
Object * obj,
CSG_MeshDescriptor *output
){
Mesh *me;
if (output == NULL || obj == NULL) return 0;
me = get_mesh(obj);
output->m_descriptor.user_face_vertex_data_size = 0;
output->m_descriptor.user_data_size = sizeof(FaceData);
output->base = NULL;
BuildMeshDescriptors(
obj,
&(output->m_face_iterator),
&(output->m_vertex_iterator)
);
output->m_destroy_func = CSG_DestroyBlenderMeshInternals;
output->base = NULL;
return 1;
}
int
CSG_AddMeshToBlender(
CSG_MeshDescriptor *mesh
){
Mesh *me_new = NULL;
Object *ob_new = NULL;
float inv_mat[4][4];
if (mesh == NULL) return 0;
if (mesh->base == NULL) return 0;
Mat4Invert(inv_mat,mesh->base->object->obmat);
// Create a new blender mesh object - using 'base' as
// a template for the new object.
ob_new= AddNewBlenderMesh(mesh->base);
me_new = ob_new->data;
// make sure the iterators are reset.
mesh->m_face_iterator.Reset(mesh->m_face_iterator.it);
mesh->m_vertex_iterator.Reset(mesh->m_vertex_iterator.it);
// iterate through results of operation and insert into new object
// see subsurf.c
ConvertCSGDescriptorsToMeshObject(
ob_new,
&(mesh->m_descriptor),
&(mesh->m_face_iterator),
&(mesh->m_vertex_iterator),
inv_mat
);
return 1;
}
int
CSG_PerformOp(
CSG_MeshDescriptor *mesh1,
CSG_MeshDescriptor *mesh2,
int int_op_type,
CSG_MeshDescriptor *output
){
CSG_OperationType op_type;
CSG_BooleanOperation * bool_op = CSG_NewBooleanFunction();
int success = 0;
if (bool_op == NULL) return 0;
if ((mesh1 == NULL) || (mesh2 == NULL) || (output == NULL)) {
return 0;
}
if ((int_op_type < 1) || (int_op_type > 3)) return 0;
switch (int_op_type) {
case 1 : op_type = e_csg_intersection; break;
case 2 : op_type = e_csg_union; break;
case 3 : op_type = e_csg_difference; break;
case 4 : op_type = e_csg_classify; break;
default : op_type = e_csg_intersection;
}
output->m_descriptor = CSG_DescibeOperands(bool_op,mesh1->m_descriptor,mesh2->m_descriptor);
output->base = mesh1->base;
if (output->m_descriptor.user_face_vertex_data_size) {
// Then use the only interp function supported
success =
CSG_PerformBooleanOperation(
bool_op,
op_type,
mesh1->m_face_iterator,
mesh1->m_vertex_iterator,
mesh2->m_face_iterator,
mesh2->m_vertex_iterator,
InterpFaceVertexData
);
} else {
success =
CSG_PerformBooleanOperation(
bool_op,
op_type,
mesh1->m_face_iterator,
mesh1->m_vertex_iterator,
mesh2->m_face_iterator,
mesh2->m_vertex_iterator,
InterpNoUserData
);
}
if (!success) {
CSG_FreeBooleanOperation(bool_op);
bool_op = NULL;
return 0;
}
// get the ouput mesh descriptors.
CSG_OutputFaceDescriptor(bool_op,&(output->m_face_iterator));
CSG_OutputVertexDescriptor(bool_op,&(output->m_vertex_iterator));
output->m_destroy_func = CSG_DestroyCSGMeshInternals;
return 1;
}
int
NewBooleanMeshTest(
struct Base * base,
struct Base * base_select,
int op_type
){
CSG_MeshDescriptor m1,m2,output;
CSG_MeshDescriptor output2,output3;
if (!MakeCSGMeshFromBlenderBase(base,&m1)) {
return 0;
}
if (!MakeCSGMeshFromBlenderBase(base_select,&m2)) {
return 0;
}
CSG_PerformOp(&m1,&m2,1,&output);
CSG_PerformOp(&m1,&m2,2,&output2);
CSG_PerformOp(&m1,&m2,3,&output3);
if (!CSG_AddMeshToBlender(&output)) {
return 0;
}
if (!CSG_AddMeshToBlender(&output2)) {
return 0;
}
if (!CSG_AddMeshToBlender(&output3)) {
return 0;
}
CSG_DestroyMeshDescriptor(&m1);
CSG_DestroyMeshDescriptor(&m2);
CSG_DestroyMeshDescriptor(&output);
CSG_DestroyMeshDescriptor(&output2);
CSG_DestroyMeshDescriptor(&output3);
return 1;
}
#endif

@ -74,7 +74,6 @@
//XXX #include "BIF_editdeform.h"
Lattice *editLatt=0;
static float *latticedata=0, latmat[4][4];
void calc_lat_fudu(int flag, int res, float *fu, float *du)
{
@ -303,23 +302,23 @@ void init_latt_deform(Object *oblatt, Object *ob)
if(lt->editlatt) lt= lt->editlatt;
bp = lt->def;
fp= latticedata= MEM_mallocN(sizeof(float)*3*lt->pntsu*lt->pntsv*lt->pntsw, "latticedata");
fp= lt->latticedata= MEM_mallocN(sizeof(float)*3*lt->pntsu*lt->pntsv*lt->pntsw, "latticedata");
/* for example with a particle system: ob==0 */
if(ob==0) {
if(ob==NULL) {
/* in deformspace, calc matrix */
Mat4Invert(latmat, oblatt->obmat);
Mat4Invert(lt->latmat, oblatt->obmat);
/* back: put in deform array */
Mat4Invert(imat, latmat);
Mat4Invert(imat, lt->latmat);
}
else {
/* in deformspace, calc matrix */
Mat4Invert(imat, oblatt->obmat);
Mat4MulMat4(latmat, ob->obmat, imat);
Mat4MulMat4(lt->latmat, ob->obmat, imat);
/* back: put in deform array */
Mat4Invert(imat, latmat);
Mat4Invert(imat, lt->latmat);
}
for(w=0,fw=lt->fw; w<lt->pntsw; w++,fw+=lt->dw) {
@ -341,19 +340,20 @@ void init_latt_deform(Object *oblatt, Object *ob)
}
}
void calc_latt_deform(float *co, float weight)
void calc_latt_deform(Object *ob, float *co, float weight)
{
Lattice *lt;
Lattice *lt= ob->data;
float u, v, w, tu[4], tv[4], tw[4];
float *fpw, *fpv, *fpu, vec[3];
int ui, vi, wi, uu, vv, ww;
if(latticedata==0) return;
if(lt->editlatt) lt= lt->editlatt;
if(lt->latticedata==NULL) return;
/* co is in local coords, treat with latmat */
VECCOPY(vec, co);
Mat4MulVecfl(latmat, vec);
Mat4MulVecfl(lt->latmat, vec);
/* u v w coords */
@ -395,10 +395,10 @@ void calc_latt_deform(float *co, float weight)
if(w!=0.0) {
if(ww>0) {
if(ww<lt->pntsw) fpw= latticedata + 3*ww*lt->pntsu*lt->pntsv;
else fpw= latticedata + 3*(lt->pntsw-1)*lt->pntsu*lt->pntsv;
if(ww<lt->pntsw) fpw= lt->latticedata + 3*ww*lt->pntsu*lt->pntsv;
else fpw= lt->latticedata + 3*(lt->pntsw-1)*lt->pntsu*lt->pntsv;
}
else fpw= latticedata;
else fpw= lt->latticedata;
for(vv= vi-1; vv<=vi+2; vv++) {
v= w*tv[vv-vi+1];
@ -431,11 +431,15 @@ void calc_latt_deform(float *co, float weight)
}
}
void end_latt_deform()
void end_latt_deform(Object *ob)
{
MEM_freeN(latticedata);
latticedata= 0;
Lattice *lt= ob->data;
if(lt->editlatt) lt= lt->editlatt;
if(lt->latticedata)
MEM_freeN(lt->latticedata);
lt->latticedata= NULL;
}
/* calculations is in local space of deformed object
@ -767,17 +771,17 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
for(j = 0; j < dvert->totweight; j++) {
if (dvert->dw[j].def_nr == index) {
calc_latt_deform(vertexCos[a], dvert->dw[j].weight);
calc_latt_deform(laOb, vertexCos[a], dvert->dw[j].weight);
}
}
}
}
} else {
for(a = 0; a < numVerts; a++) {
calc_latt_deform(vertexCos[a], 1.0f);
calc_latt_deform(laOb, vertexCos[a], 1.0f);
}
}
end_latt_deform();
end_latt_deform(laOb);
}
int object_deform_mball(Object *ob)

@ -6491,8 +6491,8 @@ static DerivedMesh * particleInstanceModifier_applyModifier(
CDDM_calc_normals(result);
if(psys->lattice){
end_latt_deform();
psys->lattice=0;
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
return result;
@ -7267,8 +7267,8 @@ static DerivedMesh * explodeModifier_explodeMesh(ExplodeModifierData *emd,
CDDM_calc_normals(explode);
if(psmd->psys->lattice){
end_latt_deform();
psmd->psys->lattice=0;
end_latt_deform(psmd->psys->lattice);
psmd->psys->lattice= NULL;
}
return explode;

@ -2273,7 +2273,7 @@ void object_handle_update(Scene *scene, Object *ob)
/* includes all keys and modifiers */
if(ob->type==OB_MESH) {
makeDerivedMesh(scene, ob, NULL, CD_MASK_BAREMESH); // here was vieweditdatamask? XXX
makeDerivedMesh(scene, ob, ((Mesh*)ob->data)->edit_mesh, CD_MASK_BAREMESH); // here was vieweditdatamask? XXX
}
else if(ob->type==OB_MBALL) {
makeDispListMBall(scene, ob);

@ -2584,7 +2584,7 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra
/* apply lattice */
if(psys->lattice && edit==0)
calc_latt_deform(ca->co, 1.0f);
calc_latt_deform(psys->lattice, ca->co, 1.0f);
/* figure out rotation */
@ -2664,8 +2664,8 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra
psys->totcached = totpart;
if(psys && psys->lattice){
end_latt_deform();
psys->lattice=0;
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
if(vg_effector)
@ -3473,7 +3473,7 @@ void psys_get_particle_on_path(Scene *scene, Object *ob, ParticleSystem *psys, i
}
if(psys->lattice && edit==0)
calc_latt_deform(state->co,1.0f);
calc_latt_deform(psys->lattice, state->co,1.0f);
}
}
}
@ -3696,7 +3696,7 @@ int psys_get_particle_state(struct Scene *scene, Object *ob, ParticleSystem *psy
do_clump(state,key1,t,part->clumpfac,part->clumppow,1.0);
if(psys->lattice)
calc_latt_deform(state->co,1.0f);
calc_latt_deform(psys->lattice, state->co,1.0f);
}
else{
if (pa) { /* TODO PARTICLE - should this ever be NULL? - Campbell */
@ -3748,7 +3748,7 @@ int psys_get_particle_state(struct Scene *scene, Object *ob, ParticleSystem *psy
}
if(psys->lattice)
calc_latt_deform(state->co,1.0f);
calc_latt_deform(psys->lattice, state->co,1.0f);
}
}

@ -1495,8 +1495,8 @@ void psys_threads_free(ParticleThread *threads)
MEM_freeN(ctx->vg_roughe);
if(ctx->psys->lattice){
end_latt_deform();
ctx->psys->lattice=0;
end_latt_deform(ctx->psys->lattice);
ctx->psys->lattice= NULL;
}
/* distribution */
@ -2629,8 +2629,8 @@ void do_effectors(int pa_no, ParticleData *pa, ParticleKey *state, Object *ob, P
}
if(epsys->lattice){
end_latt_deform();
epsys->lattice=0;
end_latt_deform(epsys->lattice);
epsys->lattice= NULL;
}
}
}
@ -4254,8 +4254,8 @@ static void cached_step(Scene *scene, Object *ob, ParticleSystemModifierData *ps
}
if(psys->lattice){
end_latt_deform();
psys->lattice=0;
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
if(pa->r_rot[0] > disp)
@ -4630,8 +4630,8 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle
if(vg_size) MEM_freeN(vg_size);
if(psys->lattice){
end_latt_deform();
psys->lattice=0;
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
}

@ -52,6 +52,11 @@ static ListBase spacetypes= {NULL, NULL};
/* not SpaceType itself */
static void spacetype_free(SpaceType *st)
{
ARegionType *art;
for(art= st->regiontypes.first; art; art= art->next)
BLI_freelistN(&art->drawcalls);
BLI_freelistN(&st->regiontypes);
}

@ -3828,7 +3828,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
wm->operators.first= wm->operators.last= NULL;
wm->keymaps.first= wm->keymaps.last= NULL;
wm->paintcursors.first= wm->paintcursors.last= NULL;
wm->queue.first= wm->queue.last= NULL;
wm->reports.first= wm->reports.last= NULL;

@ -29,9 +29,10 @@ incs = ['#/intern/guardedalloc']
incs.append('../blenlib')
incs.append('../makesdna')
incs.append('../blenkernel')
incs.append('../include')
incs.append('./')
incs.append('./intern')
incs.append('../editors/mesh')
incs.append('../editors/include')
defs = []
env.BlenderLib ( libname = 'bf_bmesh', sources = sources, includes = Split(incs), libtype = 'core', defines=defs, priority=100, compileflags=cflags )

@ -10,9 +10,11 @@
#include "BKE_global.h"
#include "BKE_DerivedMesh.h"
#include "BKE_cdderivedmesh.h"
#include "BLI_editVert.h"
#include "BIF_editmesh.h"
#include "editmesh.h"
#include "mesh_intern.h"
#include "ED_mesh.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
@ -88,7 +90,7 @@ static EditVert *bmeshvert_to_editvert(BMesh *bm, EditMesh *em, BMVert *v, int i
EditVert *eve = NULL;
v->head.eflag1 = index; /*abuse!*/
eve = addvertlist(v->co, NULL);
eve = addvertlist(em, v->co, NULL);
eve->keyindex = index;
evlist[index]= eve;
@ -125,8 +127,8 @@ static EditEdge *bmeshedge_to_editedge(BMesh *bm, EditMesh *em, BMEdge *e, EditV
{
EditEdge *eed = NULL;
if(!(findedgelist(evlist[e->v1->head.eflag1], evlist[e->v2->head.eflag1]))){
eed= addedgelist(evlist[e->v1->head.eflag1], evlist[e->v2->head.eflag1], NULL);
if(!(findedgelist(em, evlist[e->v1->head.eflag1], evlist[e->v2->head.eflag1]))){
eed= addedgelist(em, evlist[e->v1->head.eflag1], evlist[e->v2->head.eflag1], NULL);
bmeshedge_to_editedge_internal(bm, em, e, eed);
}
@ -151,7 +153,7 @@ static EditFace *bmeshface_to_editface(BMesh *bm, EditMesh *em, BMFace *f, EditV
eve4= NULL;
}
efa = addfacelist(eve1, eve2, eve3, eve4, NULL, NULL);
efa = addfacelist(em, eve1, eve2, eve3, eve4, NULL, NULL);
bmeshedge_to_editedge_internal(bm, em, f->loopbase->e, efa->e1);
bmeshedge_to_editedge_internal(bm, em, ((BMLoop*)(f->loopbase->head.next))->e, efa->e2);
@ -193,10 +195,8 @@ EditMesh *bmesh_to_editmesh_intern(BMesh *bm)
int totvert, i, numTex, numCol;
em = G.editMesh;
if (em == NULL) return NULL; //what?
em->act_face = NULL;
em = MEM_callocN(sizeof(EditMesh), "EditMesh from bmesh");
em->selectmode= bm->selectmode;
CustomData_copy(&bm->vdata, &em->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&bm->edata, &em->edata, CD_MASK_BMESH, CD_CALLOC, 0);
@ -221,7 +221,6 @@ EditMesh *bmesh_to_editmesh_intern(BMesh *bm)
bmeshface_to_editface(bm, em, f, evlist, numCol, numTex);
MEM_freeN(evlist);
countall();
return em;
}

@ -10,9 +10,11 @@
#include "BKE_global.h"
#include "BKE_DerivedMesh.h"
#include "BKE_cdderivedmesh.h"
#include "BLI_editVert.h"
#include "BIF_editmesh.h"
#include "editmesh.h"
#include "mesh_intern.h"
#include "ED_mesh.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
@ -336,7 +338,7 @@ BMesh *editmesh_to_bmesh_intern(EditMesh *em, BMesh *bm) {
int allocsize[4] = {512,512,2048,512}, numTex, numCol;
/*make sure to update FGon flags*/
EM_fgon_flags();
EM_fgon_flags(em);
/*copy custom data layout*/
CustomData_copy(&em->vdata, &bm->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
@ -356,9 +358,9 @@ BMesh *editmesh_to_bmesh_intern(EditMesh *em, BMesh *bm) {
/*copy over selection mode*/
bm->selectmode = 0;
if(G.scene->selectmode & SCE_SELECT_VERTEX) bm->selectmode |= BM_VERT;
if(G.scene->selectmode & SCE_SELECT_EDGE) bm->selectmode |= BM_EDGE;
if(G.scene->selectmode & SCE_SELECT_FACE) bm->selectmode |= BM_FACE;
if(bm->selectmode & SCE_SELECT_VERTEX) bm->selectmode |= BM_VERT;
if(bm->selectmode & SCE_SELECT_EDGE) bm->selectmode |= BM_EDGE;
if(bm->selectmode & SCE_SELECT_FACE) bm->selectmode |= BM_FACE;
/*begin editloop*/

@ -8,4 +8,4 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include #/intern/guardedalloc #intern/bmfont'
incs += ' ../../gpu ../../makesrna #/intern/opennl/extern'
env.BlenderLib ( 'bf_editors_armature', sources, Split(incs), [], libtype=['core'], priority=[100] )
env.BlenderLib ( 'bf_editors_armature', sources, Split(incs), [], libtype=['core'], priority=[44] )

@ -101,12 +101,8 @@ static void adduplicate() {}
static void countall() {}
static void vertexgroup_select_by_name() {}
static void deselect_actionchannels() {}
static void *add_defgroup_name() {return NULL;}
static void add_vert_to_defgroup() {}
#define WEIGHT_REPLACE 0
static void create_dverts() {}
static void remove_vert_defgroup() {}
static int mesh_get_x_mirror_vert() {return 0;}
static void select_actionchannel_by_name() {}
/* ************* XXX *************** */
@ -1834,7 +1830,7 @@ void ED_armature_to_edit(Object *ob)
/* adjust bone roll to align Z axis with vector
* vec is in local space and is normalized
*/
float rollBoneToVector(EditBone *bone, float new_up_axis[3])
float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3])
{
float mat[3][3], nor[3], up_axis[3], vec[3];
float roll;

@ -92,6 +92,9 @@ int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int
short hits, short extend);
void mouse_armature(struct bContext *C, short mval[2], int extend);
float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3]);
void transform_armature_mirror_update(struct Object *obedit);
/* poseobject.c */
void ED_armature_exit_posemode(struct Base *base);

@ -28,6 +28,8 @@
#ifndef ED_FILES_H
#define ED_FILES_H
struct SpaceFile;
typedef struct FileSelectParams {
int type; /* the mode of the filebrowser, FILE_BLENDER, FILE_SPECIAL, FILE_MAIN or FILE_LOADLIB */
char title[24]; /* title, also used for the text of the execute button */
@ -53,10 +55,12 @@ typedef struct FileSelectParams {
/* XXX --- end unused -- */
} FileSelectParams;
FileSelectParams* ED_fileselect_get_params(const struct bContext *C);
FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile);
short ED_fileselect_set_params(FileSelectParams *params, int type, const char *title, const char *path,
short ED_fileselect_set_params(struct SpaceFile *sfile, int type, const char *title, const char *path,
short flag, short display, short filter);
void ED_fileselect_reset_params(struct SpaceFile *sfile);
#endif /* ED_FILES_H */

@ -38,6 +38,9 @@ struct bContext;
struct wmWindowManager;
struct EditSelection;
struct ViewContext;
struct bDeformGroup;
struct MDeformWeight;
struct MDeformVert;
// edge and face flag both
#define EM_FGON 2
@ -64,6 +67,7 @@ struct ViewContext;
intptr_t mesh_octree_table(Object *ob, struct EditMesh *em, float *co, char mode);
struct EditVert *editmesh_get_x_mirror_vert(Object *ob, struct EditMesh *em, float *co);
int mesh_get_x_mirror_vert(Object *ob, int index);
/* mesh_ops.c */
void ED_operatortypes_mesh(void);
@ -119,6 +123,20 @@ void EM_free_backbuf(void);
int EM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads);
/* editdeform.c XXX rename functions? */
#define WEIGHT_REPLACE 1
#define WEIGHT_ADD 2
#define WEIGHT_SUBTRACT 3
void add_defgroup (Object *ob);
void remove_vert_defgroup (Object *ob, struct bDeformGroup *dg, int vertnum);
void remove_verts_defgroup (Object *obedit, int allverts);
struct bDeformGroup *add_defgroup_name (Object *ob, char *name);
struct MDeformWeight *verify_defweight (struct MDeformVert *dv, int defgroup);
struct MDeformWeight *get_defweight (struct MDeformVert *dv, int defgroup);
bDeformGroup *add_defgroup_name (Object *ob, char *name);
#endif /* ED_MESH_H */

@ -29,6 +29,9 @@
#ifndef ED_SPACE_API_H
#define ED_SPACE_API_H
struct ARegionType;
struct bContext;
/* the pluginnable API for export to editors */
/* calls for registering default spaces */
@ -54,5 +57,14 @@ void ED_spacetype_sequencer(void);
void ED_file_init(void);
void ED_file_exit(void);
#define REGION_DRAW_PRE 1
#define REGION_DRAW_POST 0
void *ED_region_draw_cb_activate(struct ARegionType *,
void (*draw)(const struct bContext *, struct ARegion *),
int type);
void ED_region_draw_cb_draw(const struct bContext *, struct ARegion *, int);
void ED_region_draw_cb_exit(struct ARegionType *, void *);
#endif /* ED_SPACE_API_H */

@ -40,6 +40,7 @@ struct EditEdge;
struct EditFace;
struct ImBuf;
struct Scene;
struct bContext;
/* for derivedmesh drawing callbacks, for view3d_select, .... */
typedef struct ViewContext {
@ -60,6 +61,8 @@ typedef struct VPaint {
int tot, pad; /* allocation size of prev buffers */
unsigned int *vpaint_prev; /* previous mesh colors */
struct MDeformVert *wpaint_prev; /* previous vertex weights */
void *paintcursor; /* wm handle */
} VPaint;
/* Gvp.flag and Gwp.flag */
@ -112,6 +115,9 @@ unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
#define MAXPICKBUF 10000
short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, rcti *input);
/* modes */
void ED_view3d_exit_paint_modes(struct bContext *C);
#endif /* ED_VIEW3D_H */

@ -0,0 +1,540 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "stdio.h"
#include "ctype.h"
#include "string.h"
#include "BKE_global.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "WM_types.h"
char *key_event_to_string(unsigned short event)
{
switch(event) {
case AKEY:
return "A";
break;
case BKEY:
return "B";
break;
case CKEY:
return "C";
break;
case DKEY:
return "D";
break;
case EKEY:
return "E";
break;
case FKEY:
return "F";
break;
case GKEY:
return "G";
break;
case HKEY:
return "H";
break;
case IKEY:
return "I";
break;
case JKEY:
return "J";
break;
case KKEY:
return "K";
break;
case LKEY:
return "L";
break;
case MKEY:
return "M";
break;
case NKEY:
return "N";
break;
case OKEY:
return "O";
break;
case PKEY:
return "P";
break;
case QKEY:
return "Q";
break;
case RKEY:
return "R";
break;
case SKEY:
return "S";
break;
case TKEY:
return "T";
break;
case UKEY:
return "U";
break;
case VKEY:
return "V";
break;
case WKEY:
return "W";
break;
case XKEY:
return "X";
break;
case YKEY:
return "Y";
break;
case ZKEY:
return "Z";
break;
case ZEROKEY:
return "Zero";
break;
case ONEKEY:
return "One";
break;
case TWOKEY:
return "Two";
break;
case THREEKEY:
return "Three";
break;
case FOURKEY:
return "Four";
break;
case FIVEKEY:
return "Five";
break;
case SIXKEY:
return "Six";
break;
case SEVENKEY:
return "Seven";
break;
case EIGHTKEY:
return "Eight";
break;
case NINEKEY:
return "Nine";
break;
case LEFTCTRLKEY:
return "Leftctrl";
break;
case LEFTALTKEY:
return "Leftalt";
break;
case RIGHTALTKEY:
return "Rightalt";
break;
case RIGHTCTRLKEY:
return "Rightctrl";
break;
case RIGHTSHIFTKEY:
return "Rightshift";
break;
case LEFTSHIFTKEY:
return "Leftshift";
break;
case ESCKEY:
return "Esc";
break;
case TABKEY:
return "Tab";
break;
case RETKEY:
return "Ret";
break;
case SPACEKEY:
return "Space";
break;
case LINEFEEDKEY:
return "Linefeed";
break;
case BACKSPACEKEY:
return "Backspace";
break;
case DELKEY:
return "Del";
break;
case SEMICOLONKEY:
return "Semicolon";
break;
case PERIODKEY:
return "Period";
break;
case COMMAKEY:
return "Comma";
break;
case QUOTEKEY:
return "Quote";
break;
case ACCENTGRAVEKEY:
return "Accentgrave";
break;
case MINUSKEY:
return "Minus";
break;
case SLASHKEY:
return "Slash";
break;
case BACKSLASHKEY:
return "Backslash";
break;
case EQUALKEY:
return "Equal";
break;
case LEFTBRACKETKEY:
return "Leftbracket";
break;
case RIGHTBRACKETKEY:
return "Rightbracket";
break;
case LEFTARROWKEY:
return "Leftarrow";
break;
case DOWNARROWKEY:
return "Downarrow";
break;
case RIGHTARROWKEY:
return "Rightarrow";
break;
case UPARROWKEY:
return "Uparrow";
break;
case PAD2:
return "Pad2";
break;
case PAD4:
return "Pad4";
break;
case PAD6:
return "Pad6";
break;
case PAD8:
return "Pad8";
break;
case PAD1:
return "Pad1";
break;
case PAD3:
return "Pad3";
break;
case PAD5:
return "Pad5";
break;
case PAD7:
return "Pad7";
break;
case PAD9:
return "Pad9";
break;
case PADPERIOD:
return "Padperiod";
break;
case PADSLASHKEY:
return "Padslash";
break;
case PADASTERKEY:
return "Padaster";
break;
case PAD0:
return "Pad0";
break;
case PADMINUS:
return "Padminus";
break;
case PADENTER:
return "Padenter";
break;
case PADPLUSKEY:
return "Padplus";
break;
case F1KEY:
return "F1";
break;
case F2KEY:
return "F2";
break;
case F3KEY:
return "F3";
break;
case F4KEY:
return "F4";
break;
case F5KEY:
return "F5";
break;
case F6KEY:
return "F6";
break;
case F7KEY:
return "F7";
break;
case F8KEY:
return "F8";
break;
case F9KEY:
return "F9";
break;
case F10KEY:
return "F10";
break;
case F11KEY:
return "F11";
break;
case F12KEY:
return "F12";
break;
case PAUSEKEY:
return "Pause";
break;
case INSERTKEY:
return "Insert";
break;
case HOMEKEY:
return "Home";
break;
case PAGEUPKEY:
return "Pageup";
break;
case PAGEDOWNKEY:
return "Pagedown";
break;
case ENDKEY:
return "End";
break;
}
return "";
}
/*
* Decodes key combination strings [qual1+[qual2+[...]]]keyname
* The '+'s may be replaced by '-' or ' ' characters to support different
* formats. No additional whitespace is allowed. The keyname may be an internal
* name, like "RETKEY", or a more common name, like "Return". Decoding is case-
* insensitive.
*
* Example strings: "Ctrl+L", "ALT-ESC", "Shift A"
*
* Returns 1 if successful.
*/
int decode_key_string(char *str, unsigned short *key, unsigned short *qual)
{
int i, prev, len, invalid=0;
len= strlen(str);
*key= *qual= 0;
/* Convert to upper case */
for (i=0; i<len; i++) {
str[i]= toupper(str[i]);
}
/* Handle modifiers */
for (prev=i=0; i<len; i++) {
if (str[i]==' ' || str[i]=='+' || str[i]=='-') {
// XXX if (!strncmp(str+prev, "CTRL", i-prev)) *qual |= LR_CTRLKEY;
// else if (!strncmp(str+prev, "ALT", i-prev)) *qual |= LR_ALTKEY;
// else if (!strncmp(str+prev, "SHIFT", i-prev)) *qual |= LR_SHIFTKEY;
// else if (!strncmp(str+prev, "COMMAND", i-prev)) *qual |= LR_COMMANDKEY;
prev=i+1;
}
}
/* Compare last part against key names */
if ((len-prev==1) || ((len-prev==4) && !strncmp(str+prev, "KEY", 3))) {
if (str[prev]>='A' && str[prev]<='Z') {
*key= str[prev]-'A'+AKEY;
} else if (str[prev]>='0' && str[prev]<='9') {
*key= str[prev]-'0'+ZEROKEY;
} else {
invalid= 1;
}
} else if (!strncmp(str+prev, "ZEROKEY", len-prev) || !strncmp(str+prev, "ZERO", len-prev)) {
*key= ZEROKEY;
} else if (!strncmp(str+prev, "ONEKEY", len-prev) || !strncmp(str+prev, "ONE", len-prev)) {
*key= ONEKEY;
} else if (!strncmp(str+prev, "TWOKEY", len-prev) || !strncmp(str+prev, "TWO", len-prev)) {
*key= TWOKEY;
} else if (!strncmp(str+prev, "THREEKEY", len-prev) || !strncmp(str+prev, "THREE", len-prev)) {
*key= THREEKEY;
} else if (!strncmp(str+prev, "FOURKEY", len-prev) || !strncmp(str+prev, "FOUR", len-prev)) {
*key= FOURKEY;
} else if (!strncmp(str+prev, "FIVEKEY", len-prev) || !strncmp(str+prev, "FIVE", len-prev)) {
*key= FIVEKEY;
} else if (!strncmp(str+prev, "SIZEKEY", len-prev) || !strncmp(str+prev, "SIX", len-prev)) {
*key= SIXKEY;
} else if (!strncmp(str+prev, "SEVENKEY", len-prev) || !strncmp(str+prev, "SEVEN", len-prev)) {
*key= SEVENKEY;
} else if (!strncmp(str+prev, "EIGHTKEY", len-prev) || !strncmp(str+prev, "EIGHT", len-prev)) {
*key= EIGHTKEY;
} else if (!strncmp(str+prev, "NINEKEY", len-prev) || !strncmp(str+prev, "NINE", len-prev)) {
*key= NINEKEY;
} else if (!strncmp(str+prev, "ESCKEY", len-prev) || !strncmp(str+prev, "ESC", len-prev)) {
*key= ESCKEY;
} else if (!strncmp(str+prev, "TABKEY", len-prev) || !strncmp(str+prev, "TAB", len-prev)) {
*key= TABKEY;
} else if (!strncmp(str+prev, "RETKEY", len-prev) || !strncmp(str+prev, "RETURN", len-prev) || !strncmp(str+prev, "ENTER", len-prev)) {
*key= RETKEY;
} else if (!strncmp(str+prev, "SPACEKEY", len-prev) || !strncmp(str+prev, "SPACE", len-prev)) {
*key= SPACEKEY;
} else if (!strncmp(str+prev, "LINEFEEDKEY", len-prev) || !strncmp(str+prev, "LINEFEED", len-prev)) {
*key= LINEFEEDKEY;
} else if (!strncmp(str+prev, "BACKSPACEKEY", len-prev) || !strncmp(str+prev, "BACKSPACE", len-prev)) {
*key= BACKSPACEKEY;
} else if (!strncmp(str+prev, "DELKEY", len-prev) || !strncmp(str+prev, "DELETE", len-prev)) {
*key= DELKEY;
} else if (!strncmp(str+prev, "SEMICOLONKEY", len-prev) || !strncmp(str+prev, "SEMICOLON", len-prev)) {
*key= SEMICOLONKEY;
} else if (!strncmp(str+prev, "PERIODKEY", len-prev) || !strncmp(str+prev, "PERIOD", len-prev)) {
*key= PERIODKEY;
} else if (!strncmp(str+prev, "COMMAKEY", len-prev) || !strncmp(str+prev, "COMMA", len-prev)) {
*key= COMMAKEY;
} else if (!strncmp(str+prev, "QUOTEKEY", len-prev) || !strncmp(str+prev, "QUOTE", len-prev)) {
*key= QUOTEKEY;
} else if (!strncmp(str+prev, "ACCENTGRAVEKEY", len-prev) || !strncmp(str+prev, "ACCENTGRAVE", len-prev)) {
*key= ACCENTGRAVEKEY;
} else if (!strncmp(str+prev, "MINUSKEY", len-prev) || !strncmp(str+prev, "MINUS", len-prev)) {
*key= MINUSKEY;
} else if (!strncmp(str+prev, "SLASHKEY", len-prev) || !strncmp(str+prev, "SLASH", len-prev)) {
*key= SLASHKEY;
} else if (!strncmp(str+prev, "BACKSLASHKEY", len-prev) || !strncmp(str+prev, "BACKSLASH", len-prev)) {
*key= BACKSLASHKEY;
} else if (!strncmp(str+prev, "EQUALKEY", len-prev) || !strncmp(str+prev, "EQUAL", len-prev)) {
*key= EQUALKEY;
} else if (!strncmp(str+prev, "LEFTBRACKETKEY", len-prev) || !strncmp(str+prev, "LEFTBRACKET", len-prev)) {
*key= LEFTBRACKETKEY;
} else if (!strncmp(str+prev, "RIGHTBRACKETKEY", len-prev) || !strncmp(str+prev, "RIGHTBRACKET", len-prev)) {
*key= RIGHTBRACKETKEY;
} else if (!strncmp(str+prev, "DELKEY", len-prev) || !strncmp(str+prev, "DELETE", len-prev)) {
*key= DELKEY;
} else if (!strncmp(str+prev, "LEFTARROWKEY", len-prev) || !strncmp(str+prev, "LEFTARROW", len-prev)) {
*key= LEFTARROWKEY;
} else if (!strncmp(str+prev, "DOWNARROWKEY", len-prev) || !strncmp(str+prev, "DOWNARROW", len-prev)) {
*key= DOWNARROWKEY;
} else if (!strncmp(str+prev, "RIGHTARROWKEY", len-prev) || !strncmp(str+prev, "RIGHTARROW", len-prev)) {
*key= RIGHTARROWKEY;
} else if (!strncmp(str+prev, "UPARROWKEY", len-prev) || !strncmp(str+prev, "UPARROW", len-prev)) {
*key= UPARROWKEY;
} else if (!strncmp(str+prev, "PAD", 3)) {
if (len-prev<=4) {
if (str[prev]>='0' && str[prev]<='9') {
*key= str[prev]-'0'+ZEROKEY;
} else {
invalid= 1;
}
} else if (!strncmp(str+prev+3, "PERIODKEY", len-prev-3) || !strncmp(str+prev+3, "PERIOD", len-prev-3)) {
*key= PADPERIOD;
} else if (!strncmp(str+prev+3, "SLASHKEY", len-prev-3) || !strncmp(str+prev+3, "SLASH", len-prev-3)) {
*key= PADSLASHKEY;
} else if (!strncmp(str+prev+3, "ASTERKEY", len-prev-3) || !strncmp(str+prev+3, "ASTERISK", len-prev-3)) {
*key= PADASTERKEY;
} else if (!strncmp(str+prev+3, "MINUSKEY", len-prev-3) || !strncmp(str+prev+3, "MINUS", len-prev-3)) {
*key= PADMINUS;
} else if (!strncmp(str+prev+3, "ENTERKEY", len-prev-3) || !strncmp(str+prev+3, "ENTER", len-prev-3)) {
*key= PADENTER;
} else if (!strncmp(str+prev+3, "PLUSKEY", len-prev-3) || !strncmp(str+prev+3, "PLUS", len-prev-3)) {
*key= PADPLUSKEY;
} else {
invalid= 1;
}
} else if (!strncmp(str+prev, "F1KEY", len-prev) || !strncmp(str+prev, "F1", len-prev)) {
*key= F1KEY;
} else if (!strncmp(str+prev, "F2KEY", len-prev) || !strncmp(str+prev, "F2", len-prev)) {
*key= F2KEY;
} else if (!strncmp(str+prev, "F3KEY", len-prev) || !strncmp(str+prev, "F3", len-prev)) {
*key= F3KEY;
} else if (!strncmp(str+prev, "F4KEY", len-prev) || !strncmp(str+prev, "F4", len-prev)) {
*key= F4KEY;
} else if (!strncmp(str+prev, "F5KEY", len-prev) || !strncmp(str+prev, "F5", len-prev)) {
*key= F5KEY;
} else if (!strncmp(str+prev, "F6KEY", len-prev) || !strncmp(str+prev, "F6", len-prev)) {
*key= F6KEY;
} else if (!strncmp(str+prev, "F7KEY", len-prev) || !strncmp(str+prev, "F7", len-prev)) {
*key= F7KEY;
} else if (!strncmp(str+prev, "F8KEY", len-prev) || !strncmp(str+prev, "F8", len-prev)) {
*key= F8KEY;
} else if (!strncmp(str+prev, "F9KEY", len-prev) || !strncmp(str+prev, "F9", len-prev)) {
*key= F9KEY;
} else if (!strncmp(str+prev, "F10KEY", len-prev) || !strncmp(str+prev, "F10", len-prev)) {
*key= F10KEY;
} else if (!strncmp(str+prev, "F11KEY", len-prev) || !strncmp(str+prev, "F11", len-prev)) {
*key= F11KEY;
} else if (!strncmp(str+prev, "F12KEY", len-prev) || !strncmp(str+prev, "F12", len-prev)) {
*key= F12KEY;
} else if (!strncmp(str+prev, "PAUSEKEY", len-prev) || !strncmp(str+prev, "PAUSE", len-prev)) {
*key= PAUSEKEY;
} else if (!strncmp(str+prev, "INSERTKEY", len-prev) || !strncmp(str+prev, "INSERT", len-prev)) {
*key= INSERTKEY;
} else if (!strncmp(str+prev, "HOMEKEY", len-prev) || !strncmp(str+prev, "HOME", len-prev)) {
*key= HOMEKEY;
} else if (!strncmp(str+prev, "PAGEUPKEY", len-prev) || !strncmp(str+prev, "PAGEUP", len-prev)) {
*key= PAGEUPKEY;
} else if (!strncmp(str+prev, "PAGEDOWNKEY", len-prev) || !strncmp(str+prev, "PAGEDOWN", len-prev)) {
*key= PAGEDOWNKEY;
} else if (!strncmp(str+prev, "ENDKEY", len-prev) || !strncmp(str+prev, "END", len-prev)) {
*key= ENDKEY;
} else {
invalid= 1;
}
if (!invalid && *key) {
return 1;
}
return 0;
}

@ -7,5 +7,6 @@ incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' #/intern/guardedalloc #intern/bmfont ../../gpu'
incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern'
incs += ' ../../bmesh '
env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), [], libtype=['core'], priority=[45] )

File diff suppressed because it is too large Load Diff

@ -34,6 +34,7 @@
struct bContext;
struct wmOperatorType;
struct ViewContext;
#define UVCOPY(t, s) memcpy(t, s, 2 * sizeof(float));
@ -45,7 +46,6 @@ int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge
/* ******************* meshtools.c */
int mesh_get_x_mirror_vert(Object *ob, int index);
/* XXX move to uv editor? */
enum {
@ -92,7 +92,7 @@ int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve);
int editface_containsVert(struct EditFace *efa, struct EditVert *eve);
int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
void em_setup_viewcontext(struct bContext *C, ViewContext *vc);
void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc);
/* ******************* editmesh_add.c */
@ -162,7 +162,7 @@ extern struct EditFace *EM_face_from_faces(EditMesh *em, struct EditFace *efa1,
void MESH_OT_de_select_all(struct wmOperatorType *ot);
extern EditEdge *findnearestedge(ViewContext *vc, int *dist);
extern EditEdge *findnearestedge(struct ViewContext *vc, int *dist);
extern void EM_automerge(int update);
void editmesh_select_by_material(EditMesh *em, int index);
void righthandfaces(EditMesh *em, int select); /* makes faces righthand turning */
@ -177,7 +177,7 @@ void EM_select_more(EditMesh *em);
* if 0, unselected vertice are given the bias
* strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased
*/
extern EditVert *findnearestvert(ViewContext *vc, int *dist, short sel, short strict);
extern EditVert *findnearestvert(struct ViewContext *vc, int *dist, short sel, short strict);
/* ******************* editmesh_tools.c */

@ -180,8 +180,8 @@ void ED_base_object_activate(bContext *C, Base *base)
Base *tbase;
/* activating a non-mesh, should end a couple of modes... */
// if(base && base->object->type!=OB_MESH)
// XXX exit_paint_modes();
if(base && base->object->type!=OB_MESH)
ED_view3d_exit_paint_modes(C);
/* sets scene->basact */
BASACT= base;
@ -235,19 +235,6 @@ int object_data_is_libdata(Object *ob)
void exit_paint_modes(void)
{
#if 0
if(G.f & G_VERTEXPAINT) set_vpaint();
if(G.f & G_TEXTUREPAINT) set_texturepaint();
if(G.f & G_WEIGHTPAINT) set_wpaint();
if(G.f & G_SCULPTMODE) set_sculptmode();
if(G.f & G_PARTICLEEDIT) PE_set_particle_edit();
G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE+G_PARTICLEEDIT);
#endif
}
/* exported */
void ED_object_base_init_from_view(Scene *scene, View3D *v3d, Base *base)
{
@ -284,7 +271,7 @@ void add_object_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menu
{
Object *ob;
exit_paint_modes();
// ED_view3d_exit_paint_modes(C);
// XXX if (obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */
ob= add_object(scene, type);
@ -362,7 +349,7 @@ void delete_obj(Scene *scene, View3D *v3d, int ok)
}
}
exit_paint_modes();
// ED_view3d_exit_paint_modes(C);
if(base->object->type==OB_LAMP) islamp= 1;
@ -1639,36 +1626,78 @@ void OBJECT_OT_set_restrictview(wmOperatorType *ot)
RNA_def_property_enum_items(prop, prop_set_restrictview_types);
}
/* ******************** **************** */
void reset_slowparents(Scene *scene, View3D *v3d)
/* ************* Slow Parent ******************* */
static int object_set_slowparent_exec(bContext *C, wmOperator *op)
{
/* back to original locations */
Base *base;
Scene *scene= CTX_data_scene(C);
for(base= FIRSTBASE; base; base= base->next) {
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
if(base->object->parent) base->object->partype |= PARSLOW;
base->object->recalc |= OB_RECALC_OB;
}
CTX_DATA_END;
ED_anim_dag_flush_update(C);
ED_undo_push(C,"Set Slow Parent");
WM_event_add_notifier(C, NC_SCENE, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
void OBJECT_OT_set_slowparent(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Set Slow Parent";
ot->idname= "OBJECT_OT_set_slow_parent";
/* api callbacks */
ot->invoke= WM_operator_confirm;
ot->exec= object_set_slowparent_exec;
ot->poll= ED_operator_view3d_active;
}
static int object_clear_slowparent_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
if(base->object->parent) {
if(base->object->partype & PARSLOW) {
base->object->partype -= PARSLOW;
where_is_object(scene, base->object);
base->object->partype |= PARSLOW;
base->object->recalc |= OB_RECALC_OB;
}
}
}
CTX_DATA_END;
ED_anim_dag_flush_update(C);
ED_undo_push(C,"Clear Slow Parent");
WM_event_add_notifier(C, NC_SCENE, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
void set_slowparent(Scene *scene, View3D *v3d)
void OBJECT_OT_clear_slowparent(wmOperatorType *ot)
{
Base *base;
if( okee("Set slow parent")==0 ) return;
for(base= FIRSTBASE; base; base= base->next) {
if(TESTBASELIB(v3d, base)) {
if(base->object->parent) base->object->partype |= PARSLOW;
}
}
BIF_undo_push("Slow parent");
/* identifiers */
ot->name= "Clear Slow Parent";
ot->idname= "OBJECT_OT_clear_slow_parent";
/* api callbacks */
ot->invoke= WM_operator_confirm;
ot->exec= object_clear_slowparent_exec;
ot->poll= ED_operator_view3d_active;
}
/* ******************** **************** */
// XXX
#define BEZSELECTED_HIDDENHANDLES(bezt) ((G.f & G_HIDDENHANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt))
@ -6308,55 +6337,3 @@ void hookmenu(Scene *scene, View3D *v3d)
allqueue(REDRAWBUTSEDIT, 0);
}
}
void hide_objects(Scene *scene, View3D *v3d, int select)
{
Base *base;
short changed = 0, changed_act = 0;
for(base = FIRSTBASE; base; base=base->next){
if ((base->lay & v3d->lay) && TESTBASELIB(v3d, base)==select) {
base->flag &= ~SELECT;
base->object->flag = base->flag;
base->object->restrictflag |= OB_RESTRICT_VIEW;
changed = 1;
if (base==BASACT) {
BASACT= NULL;
changed_act = 1;
}
}
}
if (changed) {
if(select) BIF_undo_push("Hide Selected Objects");
else if(select) BIF_undo_push("Hide Unselected Objects");
DAG_scene_sort(scene);
allqueue(REDRAWVIEW3D,0);
allqueue(REDRAWOOPS,0);
allqueue(REDRAWDATASELECT,0);
if (changed_act) { /* these spaces depend on the active object */
allqueue(REDRAWBUTSALL,0);
allqueue(REDRAWIPO,0);
allqueue(REDRAWACTION,0);
}
}
}
void show_objects(Scene *scene, View3D *v3d)
{
Base *base;
int changed = 0;
for(base = FIRSTBASE; base; base=base->next){
if((base->lay & v3d->lay) && base->object->restrictflag & OB_RESTRICT_VIEW) {
base->flag |= SELECT;
base->object->flag = base->flag;
base->object->restrictflag &= ~OB_RESTRICT_VIEW;
changed = 1;
}
}
if (changed) {
BIF_undo_push("Unhide Objects");
DAG_scene_sort(scene);
allqueue(REDRAWVIEW3D,0);
allqueue(REDRAWOOPS,0);
}
}

@ -51,6 +51,8 @@ void OBJECT_OT_clear_scale(wmOperatorType *ot);
void OBJECT_OT_clear_origin(wmOperatorType *ot);
void OBJECT_OT_clear_restrictview(wmOperatorType *ot);
void OBJECT_OT_set_restrictview(wmOperatorType *ot);
void OBJECT_OT_set_slowparent(wmOperatorType *ot);
void OBJECT_OT_clear_slowparent(wmOperatorType *ot);
#endif /* ED_OBJECT_INTERN_H */

@ -79,6 +79,8 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_clear_origin);
WM_operatortype_append(OBJECT_OT_clear_restrictview);
WM_operatortype_append(OBJECT_OT_set_restrictview);
WM_operatortype_append(OBJECT_OT_set_slowparent);
WM_operatortype_append(OBJECT_OT_clear_slowparent);
}
void ED_keymap_object(wmWindowManager *wm)

@ -206,33 +206,31 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
/* note; this sets state, so we can use wmOrtho and friends */
wmSubWindowSet(win, ar->swinid);
if(ar->swinid) {
/* optional header info instead? */
if(ar->headerstr) {
float col[3];
UI_SetTheme(sa);
UI_GetThemeColor3fv(TH_HEADER, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
UI_ThemeColor(TH_MENU_TEXT);
glRasterPos2i(20, 6);
BMF_DrawString(G.font, ar->headerstr);
}
else if(at->draw) {
UI_SetTheme(sa);
at->draw(C, ar);
UI_SetTheme(NULL);
}
/* optional header info instead? */
if(ar->headerstr) {
float col[3];
UI_SetTheme(sa);
UI_GetThemeColor3fv(TH_HEADER, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
if(sa)
region_draw_emboss(ar);
uiFreeInactiveBlocks(C, &ar->uiblocks);
/* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
ED_region_pixelspace(ar);
UI_ThemeColor(TH_MENU_TEXT);
glRasterPos2i(20, 6);
BMF_DrawString(G.font, ar->headerstr);
}
else if(at->draw) {
UI_SetTheme(sa);
at->draw(C, ar);
UI_SetTheme(NULL);
}
if(sa)
region_draw_emboss(ar);
uiFreeInactiveBlocks(C, &ar->uiblocks);
/* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
ED_region_pixelspace(ar);
ar->do_draw= 0;
}

@ -1119,7 +1119,8 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
}
/* called in wm_event_system.c. sets state var in screen */
/* called in wm_event_system.c. sets state vars in screen, cursors */
/* event type is mouse move */
void ED_screen_set_subwinactive(wmWindow *win, wmEvent *event)
{
if(win->screen) {

@ -0,0 +1,131 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
* Making screendumps.
*/
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_utildefines.h"
#include "BIF_gl.h"
#include "WM_types.h"
#include "WM_api.h"
static unsigned int *dumprect= NULL;
static int dumpsx, dumpsy;
/* XXX */
static int saveover() {return 0;}
/* Callback */
void write_screendump(bContext *C, char *name)
{
Scene *scene= CTX_data_scene(C);
ImBuf *ibuf;
if(dumprect) {
strcpy(G.ima, name);
BLI_convertstringcode(name, G.sce);
BLI_convertstringframe(name, scene->r.cfra); /* TODO - is this ever used? */
/* BKE_add_image_extension() checks for if extension was already set */
if(scene->r.scemode & R_EXTENSION)
if(strlen(name)<FILE_MAXDIR+FILE_MAXFILE-5)
BKE_add_image_extension(scene, name, scene->r.imtype);
if(saveover(name)) {
// waitcursor(1);
ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0, 0);
ibuf->rect= dumprect;
if(scene->r.planes == 8) IMB_cspace(ibuf, rgb_to_bw);
BKE_write_ibuf(scene, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
IMB_freeImBuf(ibuf);
// waitcursor(0);
}
MEM_freeN(dumprect);
dumprect= NULL;
}
}
/* get dump from frontbuffer */
void ED_screendump(bContext *C, int fscreen)
{
wmWindow *win= CTX_wm_window(C);
ScrArea *curarea= CTX_wm_area(C);
int x=0, y=0;
// char imstr[64];
if(dumprect) MEM_freeN(dumprect);
dumprect= NULL;
if(fscreen) { /* full screen */
x= 0;
y= 0;
dumpsx= win->sizex;
dumpsy= win->sizey;
}
else {
x= curarea->totrct.xmin;
y= curarea->totrct.ymin;
dumpsx= curarea->totrct.xmax-x;
dumpsy= curarea->totrct.ymax-y;
}
if (dumpsx && dumpsy) {
dumprect= MEM_mallocN(sizeof(int)*dumpsx*dumpsy, "dumprect");
glReadBuffer(GL_FRONT);
glReadPixels(x, y, dumpsx, dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
glFinish();
glReadBuffer(GL_BACK);
// save_image_filesel_str(imstr);
// activate_fileselect(FILE_SPECIAL, imstr, G.ima, write_screendump);
}
}

@ -32,8 +32,6 @@
*
*/
// XXX #include "GHOST_Types.h"
#include "MEM_guardedalloc.h"
#include "BLI_arithb.h"
@ -164,39 +162,25 @@ typedef struct ProjVert {
static Object *active_ob= NULL;
SculptData *sculpt_data(void)
{
return NULL; /*XXX: return &G.scene->sculptdata; */
}
static void init_brushaction(SculptData *sd, BrushAction *a, short *, short *);
static void sculpt_init_session(void);
static void init_brushaction(BrushAction *a, short *, short *);
static void sculpt_undo_push(const short);
SculptSession *sculpt_session(void)
{
if(!sculpt_data()->session)
sculpt_init_session();
return sculpt_data()->session;
}
/* ===== MEMORY =====
*
* Allocate/initialize/free data
*/
static void sculpt_init_session(void)
static void sculpt_init_session(SculptData *sd)
{
if(sculpt_data()->session)
if(sd->session)
;/*XXX: sculptsession_free(G.scene); */
sculpt_data()->session= MEM_callocN(sizeof(SculptSession), "SculptSession");
sd->session= MEM_callocN(sizeof(SculptSession), "SculptSession");
}
/* vertex_users is an array of Lists that store all the faces that use a
particular vertex. vertex_users is in the same order as mesh.mvert */
static void calc_vertex_users()
static void calc_vertex_users(SculptSession *ss)
{
SculptSession *ss= sculpt_session();
int i,j;
IndexNode *node= NULL;
@ -236,7 +220,7 @@ void sculptmode_rem_tex(void *junk0,void *junk1)
MEM_freeN(ss->texcache);
ss->texcache= NULL;
}
BIF_undo_push("Unlink brush texture");
// XXX BIF_undo_push("Unlink brush texture");
allqueue(REDRAWBUTSEDIT, 0);
allqueue(REDRAWOOPS, 0);
}
@ -292,9 +276,8 @@ float get_depth(short x, short y)
/* Uses window coordinates (x,y) and depth component z to find a point in
modelspace */
void unproject(float out[3], const short x, const short y, const float z)
void unproject(SculptSession *ss, float out[3], const short x, const short y, const float z)
{
SculptSession *ss= sculpt_session();
double ux, uy, uz;
gluUnProject(x,y,z, ss->mats->modelview, ss->mats->projection,
@ -305,9 +288,8 @@ void unproject(float out[3], const short x, const short y, const float z)
}
/* Convert a point in model coordinates to 2D screen coordinates. */
static void projectf(const float v[3], float p[2])
static void projectf(SculptSession *ss, const float v[3], float p[2])
{
SculptSession *ss= sculpt_session();
double ux, uy, uz;
gluProject(v[0],v[1],v[2], ss->mats->modelview, ss->mats->projection,
@ -316,10 +298,10 @@ static void projectf(const float v[3], float p[2])
p[1]= uy;
}
static void project(const float v[3], short p[2])
static void project(SculptSession *ss, const float v[3], short p[2])
{
float f[2];
projectf(v, f);
projectf(ss, v, f);
p[0]= f[0];
p[1]= f[1];
@ -333,12 +315,11 @@ static void project(const float v[3], short p[2])
shrink the brush. Skipped for grab brush because only the first mouse down
size is used, which is small if the user has just touched the pen to the
tablet */
char brush_size(Brush *b)
char brush_size(SculptData *sd, Brush *b)
{
SculptData *sd = NULL; /* XXX */
float size= b->size;
float pressure= 0; /* XXX: get_pressure(); */
short activedevice= get_activedevice();
short activedevice= 0; /* XXX: get_activedevice(); */
if(b->sculpt_tool!=SCULPT_TOOL_GRAB) {
const float size_factor= sd->tablet_size / 10.0f;
@ -355,12 +336,11 @@ char brush_size(Brush *b)
/* Return modified brush strength. Includes the direction of the brush, positive
values pull vertices, negative values push. Uses tablet pressure and a
special multiplier found experimentally to scale the strength factor. */
float brush_strength(Brush *b, BrushAction *a)
float brush_strength(SculptData *sd, Brush *b, BrushAction *a)
{
SculptData *sd = NULL; /* XXX */
float dir= b->flag & BRUSH_DIR_IN ? -1 : 1;
float pressure= 1;
short activedevice= get_activedevice();
short activedevice= 0;/*XXX: get_activedevice(); */
float flip= a->flip ? -1:1;
float anchored = b->flag & BRUSH_ANCHORED ? 25 : 1;
@ -408,9 +388,8 @@ void sculpt_clip(const BrushAction *a, float *co, const float val[3])
}
}
void sculpt_axislock(float *co)
void sculpt_axislock(SculptData *sd, float *co)
{
SculptData *sd = sculpt_data();
if (sd->flags & (SCULPT_LOCK_X|SCULPT_LOCK_Y|SCULPT_LOCK_Z)) return;
/* XXX: if(G.vd->twmode == V3D_MANIP_LOCAL) { */
if(0) {
@ -444,16 +423,15 @@ static void add_norm_if(float view_vec[3], float out[3], float out_flip[3], cons
/* Currently only for the draw brush; finds average normal for all active
vertices */
void calc_area_normal(float out[3], const BrushAction *a, const float *outdir, const ListBase* active_verts)
void calc_area_normal(SculptData *sd, float out[3], const BrushAction *a, const float *outdir, const ListBase* active_verts)
{
ActiveData *node = active_verts->first;
SculptData *sd = sculpt_data();
const int view = 0; /* XXX: should probably be a flag, not number: sd->brush_type==SCULPT_TOOL_DRAW ? sculptmode_brush()->view : 0; */
float out_flip[3];
out[0]=out[1]=out[2] = out_flip[0]=out_flip[1]=out_flip[2] = 0;
if(sculptmode_brush()->flag & BRUSH_ANCHORED) {
if(sd->brush->flag & BRUSH_ANCHORED) {
for(; node; node = node->next)
add_norm_if(((BrushAction*)a)->symm.out, out, out_flip, a->orig_norms[node->Index]);
}
@ -477,14 +455,14 @@ void calc_area_normal(float out[3], const BrushAction *a, const float *outdir, c
Normalize(out);
}
void do_draw_brush(SculptSession *ss, const BrushAction *a, const ListBase* active_verts)
void do_draw_brush(SculptData *sd, SculptSession *ss, const BrushAction *a, const ListBase* active_verts)
{
float area_normal[3];
ActiveData *node= active_verts->first;
calc_area_normal(area_normal, a, a->symm.out, active_verts);
calc_area_normal(sd, area_normal, a, a->symm.out, active_verts);
sculpt_axislock(area_normal);
sculpt_axislock(sd, area_normal);
while(node){
float *co= ss->mvert[node->Index].co;
@ -576,14 +554,14 @@ void do_pinch_brush(SculptSession *ss, const BrushAction *a, const ListBase* act
}
}
void do_grab_brush(SculptSession *ss, BrushAction *a)
void do_grab_brush(SculptData *sd, SculptSession *ss, BrushAction *a)
{
ActiveData *node= a->grab_active_verts[a->symm.index].first;
float add[3];
float grab_delta[3];
VecCopyf(grab_delta, a->symm.grab_delta);
sculpt_axislock(grab_delta);
sculpt_axislock(sd, grab_delta);
while(node) {
float *co= ss->mvert[node->Index].co;
@ -598,13 +576,13 @@ void do_grab_brush(SculptSession *ss, BrushAction *a)
}
void do_layer_brush(SculptSession *ss, BrushAction *a, const ListBase *active_verts)
void do_layer_brush(SculptData *sd, SculptSession *ss, BrushAction *a, const ListBase *active_verts)
{
float area_normal[3];
ActiveData *node= active_verts->first;
const float bstr= brush_strength(sculptmode_brush(), a);
const float bstr= brush_strength(sd, sd->brush, a);
calc_area_normal(area_normal, a, NULL, active_verts);
calc_area_normal(sd, area_normal, a, NULL, active_verts);
while(node){
float *disp= &a->layer_disps[node->Index];
@ -682,14 +660,14 @@ void calc_flatten_center(SculptSession *ss, ActiveData *node, float co[3])
VecMulf(co, 1.0f / FLATTEN_SAMPLE_SIZE);
}
void do_flatten_brush(SculptSession *ss, const BrushAction *a, const ListBase *active_verts)
void do_flatten_brush(SculptData *sd, SculptSession *ss, const BrushAction *a, const ListBase *active_verts)
{
ActiveData *node= active_verts->first;
/* area_normal and cntr define the plane towards which vertices are squashed */
float area_normal[3];
float cntr[3];
calc_area_normal(area_normal, a, a->symm.out, active_verts);
calc_area_normal(sd, area_normal, a, a->symm.out, active_verts);
calc_flatten_center(ss, node, cntr);
while(node){
@ -733,17 +711,15 @@ void flip_coord(float co[3], const char symm)
}
/* Use the warpfac field in MTex to store a rotation value for sculpt textures. Value is in degrees */
float sculpt_tex_angle(void)
float sculpt_tex_angle(SculptData *sd)
{
SculptData *sd= sculpt_data();
if(sd->texact!=-1 && sd->mtex[sd->texact])
return sd->mtex[sd->texact]->warpfac;
return 0;
}
void set_tex_angle(const float f)
void set_tex_angle(SculptData *sd, const float f)
{
SculptData *sd = sculpt_data();
if(sd->texact != -1 && sd->mtex[sd->texact])
sd->mtex[sd->texact]->warpfac = f;
}
@ -796,10 +772,9 @@ static float get_texcache_pixel_bilinear(const SculptSession *ss, float u, float
}
/* Return a multiplier for brush strength on a particular vertex. */
float tex_strength(BrushAction *a, float *point, const float len,const unsigned vindex)
float tex_strength(SculptData *sd, BrushAction *a, float *point, const float len,const unsigned vindex)
{
SculptData *sd= sculpt_data();
SculptSession *ss= sculpt_session();
SculptSession *ss= sd->session;
float avg= 1;
if(sd->texact==-1 || !sd->mtex[sd->texact])
@ -824,7 +799,7 @@ float tex_strength(BrushAction *a, float *point, const float len,const unsigned
}
else if(ss->texcache) {
const float bsize= a->radius * 2;
const float rot= to_rad(sculpt_tex_angle()) + a->anchored_rot;
const float rot= to_rad(sculpt_tex_angle(sd)) + a->anchored_rot;
int px, py;
float flip[3], point_2d[2];
@ -833,7 +808,7 @@ float tex_strength(BrushAction *a, float *point, const float len,const unsigned
that the brush texture will be oriented correctly. */
VecCopyf(flip, point);
flip_coord(flip, a->symm.index);
projectf(flip, point_2d);
projectf(ss, flip, point_2d);
/* For Tile and Drag modes, get the 2D screen coordinates of the
and scale them up or down to the texture size. */
@ -881,22 +856,21 @@ float tex_strength(BrushAction *a, float *point, const float len,const unsigned
/* Mark area around the brush as damaged. projverts are marked if they are
inside the area and the damaged rectangle in 2D screen coordinates is
added to damaged_rects. */
void sculpt_add_damaged_rect(BrushAction *a)
void sculpt_add_damaged_rect(SculptSession *ss, BrushAction *a)
{
short p[2];
RectNode *rn= MEM_mallocN(sizeof(RectNode),"RectNode");
SculptSession *ss = sculpt_session();
const float radius = a->radius > a->prev_radius ? a->radius : a->prev_radius;
unsigned i;
/* Find center */
project(a->symm.center_3d, p);
project(ss, a->symm.center_3d, p);
rn->r.xmin= p[0] - radius;
rn->r.ymin= p[1] - radius;
rn->r.xmax= p[0] + radius;
rn->r.ymax= p[1] + radius;
BLI_addtail(&sculpt_session()->damaged_rects, rn);
BLI_addtail(&ss->damaged_rects, rn);
/* Update insides */
for(i=0; i<ss->totvert; ++i) {
@ -939,7 +913,7 @@ void sculpt_clear_damaged_areas(SculptSession *ss)
}
}
void do_brush_action(Brush *b, BrushAction *a)
void do_brush_action(SculptData *sd, BrushAction *a)
{
int i;
float av_dist;
@ -947,12 +921,12 @@ void do_brush_action(Brush *b, BrushAction *a)
ActiveData *adata= 0;
float *vert;
Mesh *me= NULL; /*XXX: get_mesh(OBACT); */
const float bstrength= brush_strength(sculptmode_brush(), a);
const float bstrength= brush_strength(sd, sd->brush, a);
KeyBlock *keyblock= NULL; /*XXX: ob_get_keyblock(OBACT); */
SculptData *sd = sculpt_data();
SculptSession *ss = sculpt_session();
SculptSession *ss = sd->session;
Brush *b = sd->brush;
sculpt_add_damaged_rect(a);
sculpt_add_damaged_rect(ss, a);
/* Build a list of all vertices that are potentially within the brush's
area of influence. Only do this once for the grab brush. */
@ -969,7 +943,7 @@ void do_brush_action(Brush *b, BrushAction *a)
adata->Index = i;
/* Fade is used to store the final strength at which the brush
should modify a particular vertex. */
adata->Fade= tex_strength(a, vert, av_dist, i) * bstrength;
adata->Fade= tex_strength(sd, a, vert, av_dist, i) * bstrength;
adata->dist = av_dist;
if(b->sculpt_tool == SCULPT_TOOL_GRAB && a->firsttime)
@ -986,7 +960,7 @@ void do_brush_action(Brush *b, BrushAction *a)
/* Apply one type of brush action */
switch(b->sculpt_tool){
case SCULPT_TOOL_DRAW:
do_draw_brush(ss, a, &active_verts);
do_draw_brush(sd, ss, a, &active_verts);
break;
case SCULPT_TOOL_SMOOTH:
do_smooth_brush(ss, a, &active_verts);
@ -998,13 +972,13 @@ void do_brush_action(Brush *b, BrushAction *a)
do_inflate_brush(ss, a, &active_verts);
break;
case SCULPT_TOOL_GRAB:
do_grab_brush(ss, a);
do_grab_brush(sd, ss, a);
break;
case SCULPT_TOOL_LAYER:
do_layer_brush(ss, a, &active_verts);
do_layer_brush(sd, ss, a, &active_verts);
break;
case SCULPT_TOOL_FLATTEN:
do_flatten_brush(ss, a, &active_verts);
do_flatten_brush(sd, ss, a, &active_verts);
break;
}
@ -1046,16 +1020,15 @@ void calc_brushdata_symm(BrushAction *a, const char symm)
flip_coord(a->symm.grab_delta, symm);
}
void do_symmetrical_brush_actions(BrushAction *a, short co[2], short pr_co[2])
void do_symmetrical_brush_actions(SculptData *sd, BrushAction *a, short co[2], short pr_co[2])
{
SculptData *sd = NULL; // XXX
const char symm = sd->flags & 7;
BrushActionSymm orig;
int i;
init_brushaction(a, co, pr_co);
init_brushaction(sd, a, co, pr_co);
orig = a->symm;
do_brush_action(sd->brush, a);
do_brush_action(sd, a);
for(i = 1; i <= symm; ++i) {
if(symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5))) {
@ -1063,7 +1036,7 @@ void do_symmetrical_brush_actions(BrushAction *a, short co[2], short pr_co[2])
a->symm = orig;
calc_brushdata_symm(a, i);
do_brush_action(sd->brush, a);
do_brush_action(sd, a);
}
}
@ -1093,14 +1066,13 @@ void add_face_normal(vec3f *norm, MVert *mvert, const MFace* face, float *fn)
norm->z+= final[2];
}
void update_damaged_vert(ListBase *lb, BrushAction *a)
void update_damaged_vert(SculptSession *ss, ListBase *lb, BrushAction *a)
{
ActiveData *vert;
SculptSession *ss = sculpt_session();
for(vert= lb->first; vert; vert= vert->next) {
vec3f norm= {0,0,0};
IndexNode *face= sculpt_session()->vertex_users[vert->Index].first;
IndexNode *face= ss->vertex_users[vert->Index].first;
while(face){
float *fn = NULL;
@ -1117,16 +1089,16 @@ void update_damaged_vert(ListBase *lb, BrushAction *a)
}
}
void calc_damaged_verts(ListBase *damaged_verts, BrushAction *a)
void calc_damaged_verts(SculptSession *ss, BrushAction *a)
{
int i;
for(i=0; i<8; ++i)
update_damaged_vert(&a->grab_active_verts[i], a);
update_damaged_vert(ss, &a->grab_active_verts[i], a);
update_damaged_vert(damaged_verts, a);
BLI_freelistN(damaged_verts);
damaged_verts->first = damaged_verts->last = NULL;
update_damaged_vert(ss, &ss->damaged_verts, a);
BLI_freelistN(&ss->damaged_verts);
ss->damaged_verts.first = ss->damaged_verts.last = NULL;
}
void projverts_clear_inside(SculptSession *ss)
@ -1136,10 +1108,9 @@ void projverts_clear_inside(SculptSession *ss)
ss->projverts[i].inside = 0;
}
void sculptmode_update_tex()
void sculptmode_update_tex(SculptData *sd)
{
SculptData *sd= sculpt_data();
SculptSession *ss= sculpt_session();
SculptSession *ss= sd->session;
MTex *mtex = sd->mtex[sd->texact];
TexResult texres = {0};
float x, y, step=2.0/TC_SIZE, co[3];
@ -1188,10 +1159,9 @@ void sculptmode_update_tex()
}
/* pr_mouse is only used for the grab brush, can be NULL otherwise */
static void init_brushaction(BrushAction *a, short *mouse, short *pr_mouse)
static void init_brushaction(SculptData *sd, BrushAction *a, short *mouse, short *pr_mouse)
{
SculptData *sd = sculpt_data();
SculptSession *ss = sculpt_session();
SculptSession *ss = sd->session;
Brush *b = sd->brush;
Object *ob = NULL; /* XXX */
const float mouse_depth = get_depth(mouse[0], mouse[1]);
@ -1199,9 +1169,9 @@ static void init_brushaction(BrushAction *a, short *mouse, short *pr_mouse)
ModifierData *md;
int i;
const char flip = 0; /*XXX: (get_qual() == LR_SHIFTKEY); */
const char anchored = sculptmode_brush()->flag & BRUSH_ANCHORED;
const int anchored = sd->brush->flag & BRUSH_ANCHORED;
short orig_mouse[2], dx=0, dy=0;
float size = brush_size(b);
float size = brush_size(sd, b);
a->flip = flip;
a->symm.index = 0;
@ -1212,23 +1182,23 @@ static void init_brushaction(BrushAction *a, short *mouse, short *pr_mouse)
/* Convert the location and size of the brush to
modelspace coords */
if(a->firsttime || !anchored) {
unproject(a->symm.center_3d, mouse[0], mouse[1], mouse_depth);
unproject(ss, a->symm.center_3d, mouse[0], mouse[1], mouse_depth);
a->mouse[0] = mouse[0];
a->mouse[1] = mouse[1];
}
if(anchored) {
project(a->symm.center_3d, orig_mouse);
project(ss, a->symm.center_3d, orig_mouse);
dx = mouse[0] - orig_mouse[0];
dy = mouse[1] - orig_mouse[1];
}
if(anchored) {
unproject(brush_edge_loc, mouse[0], mouse[1], a->depth);
unproject(ss, brush_edge_loc, mouse[0], mouse[1], a->depth);
a->anchored_rot = atan2(dy, dx);
}
else
unproject(brush_edge_loc, mouse[0] + size, mouse[1], mouse_depth);
unproject(ss, brush_edge_loc, mouse[0] + size, mouse[1], mouse_depth);
a->size_3d = VecLenf(a->symm.center_3d, brush_edge_loc);
@ -1244,10 +1214,10 @@ static void init_brushaction(BrushAction *a, short *mouse, short *pr_mouse)
VecCopyf(sd->pivot, a->symm.center_3d);
/* Now project the Up, Right, and Out normals from view to model coords */
unproject(zero_loc, 0, 0, 0);
unproject(a->symm.up, 0, -1, 0);
unproject(a->symm.right, 1, 0, 0);
unproject(a->symm.out, 0, 0, -1);
unproject(ss, zero_loc, 0, 0, 0);
unproject(ss, a->symm.up, 0, -1, 0);
unproject(ss, a->symm.right, 1, 0, 0);
unproject(ss, a->symm.out, 0, 0, -1);
VecSubf(a->symm.up, a->symm.up, zero_loc);
VecSubf(a->symm.right, a->symm.right, zero_loc);
VecSubf(a->symm.out, a->symm.out, zero_loc);
@ -1276,8 +1246,8 @@ static void init_brushaction(BrushAction *a, short *mouse, short *pr_mouse)
float gcenter[3];
/* Find the delta */
unproject(gcenter, mouse[0], mouse[1], a->depth);
unproject(oldloc, pr_mouse[0], pr_mouse[1], a->depth);
unproject(ss, gcenter, mouse[0], mouse[1], a->depth);
unproject(ss, oldloc, pr_mouse[0], pr_mouse[1], a->depth);
VecSubf(a->symm.grab_delta, gcenter, oldloc);
}
else if(b->sculpt_tool == SCULPT_TOOL_LAYER) {
@ -1444,16 +1414,15 @@ void sculptmode_selectbrush_menu(void)
}*/
}
void sculptmode_update_all_projverts(float *vertcosnos)
void sculptmode_update_all_projverts(SculptSession *ss)
{
SculptSession *ss = sculpt_session();
unsigned i;
if(!ss->projverts)
ss->projverts = MEM_mallocN(sizeof(ProjVert)*ss->totvert,"ProjVerts");
for(i=0; i<ss->totvert; ++i) {
project(vertcosnos ? &vertcosnos[i * 6] : ss->mvert[i].co, ss->projverts[i].co);
project(ss, ss->vertexcosnos ? &ss->vertexcosnos[i * 6] : ss->mvert[i].co, ss->projverts[i].co);
ss->projverts[i].inside= 0;
}
}
@ -1593,21 +1562,43 @@ void sculptmode_draw_mesh(int only_damaged)
}
#endif
void sculptmode_correct_state(void)
static void sculpt_undo_push(SculptData *sd)
{
if(!sculpt_session())
sculpt_init_session();
/*XXX: switch(sd->brush->sculpt_tool) {
case SCULPT_TOOL_DRAW:
BIF_undo_push("Draw Brush"); break;
case SCULPT_TOOL_SMOOTH:
BIF_undo_push("Smooth Brush"); break;
case SCULPT_TOOL_PINCH:
BIF_undo_push("Pinch Brush"); break;
case SCULPT_TOOL_INFLATE:
BIF_undo_push("Inflate Brush"); break;
case SCULPT_TOOL_GRAB:
BIF_undo_push("Grab Brush"); break;
case SCULPT_TOOL_LAYER:
BIF_undo_push("Layer Brush"); break;
case SCULPT_TOOL_FLATTEN:
BIF_undo_push("Flatten Brush"); break;
default:
BIF_undo_push("Sculpting"); break;
}*/
}
void sculptmode_correct_state(SculptData *sd)
{
if(!sd->session)
sculpt_init_session(sd);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
if(!sculpt_session()->vertex_users) calc_vertex_users();
if(!sd->session->vertex_users) calc_vertex_users(sd->session);
}
void sculpt(void)
void sculpt(SculptData *sd)
{
SculptData *sd= sculpt_data();
SculptSession *ss= sculpt_session();
SculptSession *ss= sd->session;
Object *ob= NULL; /*XXX */
Mesh *me;
MultiresModifierData *mmd = NULL;
@ -1634,11 +1625,11 @@ void sculpt(void)
}*/
if(!ss) {
sculpt_init_session();
sculpt_init_session(sd);
ss= sd->session;
}
anchored = sculptmode_brush()->flag & BRUSH_ANCHORED;
anchored = sd->brush->flag & BRUSH_ANCHORED;
smooth_stroke = (sd->flags & SCULPT_INPUT_SMOOTH) && (sd->brush->sculpt_tool != SCULPT_TOOL_GRAB) && !anchored;
if(smooth_stroke)
@ -1654,7 +1645,7 @@ void sculpt(void)
/* Check that vertex users are up-to-date */
if(ob != active_ob || !ss->vertex_users || ss->vertex_users_size != ss->totvert) {
sculpt_vertexusers_free(ss);
calc_vertex_users();
calc_vertex_users(ss);
if(ss->projverts)
MEM_freeN(ss->projverts);
ss->projverts = NULL;
@ -1671,9 +1662,9 @@ void sculpt(void)
/* Init texture
FIXME: Shouldn't be doing this every time! */
if(sd->texrept!=SCULPTREPT_3D)
sculptmode_update_tex();
sculptmode_update_tex(sd);
getmouseco_areawin(mouse);
/*XXX: getmouseco_areawin(mouse); */
mvalo[0]= mouse[0];
mvalo[1]= mouse[1];
lastSigMouse[0]=mouse[0];
@ -1689,7 +1680,7 @@ void sculpt(void)
if(modifier_calculations)
ss->vertexcosnos= mesh_get_mapped_verts_nors(NULL, ob); /* XXX: scene = ? */
sculptmode_update_all_projverts(ss->vertexcosnos);
sculptmode_update_all_projverts(ss);
/* Set scaling adjustment */
a->scale[0]= 1.0f / ob->size[0];
@ -1704,27 +1695,27 @@ void sculpt(void)
glGetIntegerv(GL_SCISSOR_BOX, scissor_box);
/* For raking, get the original angle*/
offsetRot=sculpt_tex_angle();
offsetRot=sculpt_tex_angle(sd);
me = get_mesh(ob);
while (get_mbut() & mousebut) {
getmouseco_areawin(mouse);
while (/*XXX:get_mbut() & mousebut*/0) {
/* XXX: getmouseco_areawin(mouse); */
/* If rake, and the mouse has moved over 10 pixels (euclidean) (prevents jitter) then get the new angle */
if (rake && (pow(lastSigMouse[0]-mouse[0],2)+pow(lastSigMouse[1]-mouse[1],2))>100){
/*Nasty looking, but just orig + new angle really*/
set_tex_angle(offsetRot+180.+to_deg(atan2((float)(mouse[1]-lastSigMouse[1]),(float)(mouse[0]-lastSigMouse[0]))));
set_tex_angle(sd, offsetRot+180.+to_deg(atan2((float)(mouse[1]-lastSigMouse[1]),(float)(mouse[0]-lastSigMouse[0]))));
lastSigMouse[0]=mouse[0];
lastSigMouse[1]=mouse[1];
}
if(firsttime || mouse[0]!=mvalo[0] || mouse[1]!=mvalo[1] ||
sculptmode_brush()->flag & BRUSH_AIRBRUSH) {
sd->brush->flag & BRUSH_AIRBRUSH) {
a->firsttime = firsttime;
firsttime= 0;
if(smooth_stroke)
sculpt_stroke_add_point(mouse[0], mouse[1]);
sculpt_stroke_add_point(ss->stroke, mouse[0], mouse[1]);
spacing+= sqrt(pow(mvalo[0]-mouse[0],2)+pow(mvalo[1]-mouse[1],2));
@ -1743,32 +1734,32 @@ void sculpt(void)
}
}
do_symmetrical_brush_actions(a, mouse, NULL);
do_symmetrical_brush_actions(sd, a, mouse, NULL);
}
else {
if(smooth_stroke) {
sculpt_stroke_apply(a);
sculpt_stroke_apply(sd, ss->stroke, a);
}
else if(sd->spacing==0 || spacing>sd->spacing) {
do_symmetrical_brush_actions(a, mouse, NULL);
do_symmetrical_brush_actions(sd, a, mouse, NULL);
spacing= 0;
}
}
}
else {
do_symmetrical_brush_actions(a, mouse, mvalo);
unproject(sd->pivot, mouse[0], mouse[1], a->depth);
do_symmetrical_brush_actions(sd, a, mouse, mvalo);
unproject(ss, sd->pivot, mouse[0], mouse[1], a->depth);
}
if((!ss->multires && modifier_calculations) || ob_get_keyblock(ob))
;/* XXX: DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); */
if(modifier_calculations || sd->brush->sculpt_tool == SCULPT_TOOL_GRAB || !(sd->flags & SCULPT_DRAW_FAST)) {
calc_damaged_verts(&ss->damaged_verts, a);
/*XXX: scrarea_do_windraw(curarea); */
screen_swapbuffers();
calc_damaged_verts(ss, a);
/*XXX: scrarea_do_windraw(curarea);
screen_swapbuffers(); */
} else { /* Optimized drawing */
calc_damaged_verts(&ss->damaged_verts, a);
calc_damaged_verts(ss, a);
/* Draw the stored image to the screen */
glAccum(GL_RETURN, 1);
@ -1777,7 +1768,7 @@ void sculpt(void)
/* Draw all the polygons that are inside the modified area(s) */
glScissor(scissor_box[0], scissor_box[1], scissor_box[2], scissor_box[3]);
sculptmode_draw_mesh(1);
/* XXX: sculptmode_draw_mesh(1); */
glAccum(GL_LOAD, 1);
projverts_clear_inside(ss);
@ -1786,12 +1777,12 @@ void sculpt(void)
glDisable(GL_DEPTH_TEST);
/* Draw cursor */
if(sculpt_data()->flags & SCULPT_TOOL_DRAW)
fdrawXORcirc((float)mouse[0],(float)mouse[1],sculptmode_brush()->size);
if(smooth_stroke)
sculpt_stroke_draw();
if(sd->flags & SCULPT_TOOL_DRAW)
fdrawXORcirc((float)mouse[0],(float)mouse[1],sd->brush->size);
/* XXX: if(smooth_stroke)
sculpt_stroke_draw();
myswapbuffers();
myswapbuffers(); */
}
BLI_freelistN(&ss->damaged_rects);
@ -1806,15 +1797,15 @@ void sculpt(void)
}
}
else BIF_wait_for_statechange();
else ;/*XXX:BIF_wait_for_statechange();*/
}
/* Set the rotation of the brush back to what it was before any rake */
set_tex_angle(offsetRot);
set_tex_angle(sd, offsetRot);
if(smooth_stroke) {
sculpt_stroke_apply_all(a);
calc_damaged_verts(&ss->damaged_verts, a);
sculpt_stroke_apply_all(sd, ss->stroke, a);
calc_damaged_verts(ss, a);
BLI_freelistN(&ss->damaged_rects);
}
@ -1824,7 +1815,8 @@ void sculpt(void)
for(i=0; i<8; ++i)
BLI_freelistN(&a->grab_active_verts[i]);
MEM_freeN(a);
sculpt_stroke_free();
sculpt_stroke_free(ss->stroke);
ss->stroke = NULL;
if(mmd) {
if(mmd->undo_verts && mmd->undo_verts != ss->mvert)
@ -1834,65 +1826,44 @@ void sculpt(void)
mmd->undo_verts_tot = ss->totvert;
}
/* XXX: sculpt_undo_push(G.scene->sculptdata.brush_type); */
sculpt_undo_push(sd);
/* XXX: if(G.vd->depths) G.vd->depths->damaged= 1;
allqueue(REDRAWVIEW3D, 0); */
}
static void sculpt_undo_push(const short brush_type)
void ED_sculpt_enter_sculptmode()
{
switch(brush_type) {
case SCULPT_TOOL_DRAW:
BIF_undo_push("Draw Brush"); break;
case SCULPT_TOOL_SMOOTH:
BIF_undo_push("Smooth Brush"); break;
case SCULPT_TOOL_PINCH:
BIF_undo_push("Pinch Brush"); break;
case SCULPT_TOOL_INFLATE:
BIF_undo_push("Inflate Brush"); break;
case SCULPT_TOOL_GRAB:
BIF_undo_push("Grab Brush"); break;
case SCULPT_TOOL_LAYER:
BIF_undo_push("Layer Brush"); break;
case SCULPT_TOOL_FLATTEN:
BIF_undo_push("Flatten Brush"); break;
default:
BIF_undo_push("Sculpting"); break;
}
G.f |= G_SCULPTMODE;
sculpt_init_session(NULL /*XXX*/);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
active_ob = NULL;
}
void set_sculptmode(void)
void ED_sculpt_exit_sculptmode()
{
if(G.f & G_SCULPTMODE) {
Object *ob = NULL; /*XXX: OBACT; */
Mesh *me= get_mesh(ob);
Object *ob = NULL; /*XXX: OBACT; */
Mesh *me= get_mesh(ob);
multires_force_update(ob);
multires_force_update(ob);
G.f &= ~G_SCULPTMODE;
G.f &= ~G_SCULPTMODE;
/* XXX: sculptsession_free(G.scene); */
if(me && me->pv)
mesh_pmv_off(ob, me);
}
else {
G.f |= G_SCULPTMODE;
/* XXX: sculptsession_free(G.scene); */
if(me && me->pv)
mesh_pmv_off(ob, me);
/* Called here to sanity-check the brush */
sculptmode_brush();
sculpt_init_session();
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
}
active_ob= NULL;
active_ob = NULL;
}
/* Partial Mesh Visibility */
/* XXX: Partial vis. always was a mess, have to figure something out */
#if 0
/* mode: 0=hide outside selection, 1=hide inside selection */
static void sculptmode_do_pmv(Object *ob, rcti *hb_2d, int mode)
{
@ -2115,3 +2086,4 @@ void sculptmode_pmv(int mode)
waitcursor(0);
}
#endif

@ -47,17 +47,7 @@ struct ScrArea;
struct SculptData;
struct SculptStroke;
struct SculptSession *sculpt_session(void);
struct SculptData *sculpt_data(void);
/* Memory */
void sculptmode_correct_state(void);
/* Interface */
void sculptmode_draw_interface_tools(struct uiBlock *block,unsigned short cx, unsigned short cy);
void sculptmode_draw_interface_brush(struct uiBlock *block,unsigned short cx, unsigned short cy);
void sculptmode_draw_interface_textures(struct uiBlock *block,unsigned short cx, unsigned short cy);
void sculptmode_rem_tex(void*,void*);
void sculptmode_selectbrush_menu(void);
void sculptmode_draw_mesh(int);
void sculpt_paint_brush(char clear);
@ -65,21 +55,17 @@ void sculpt_stroke_draw();
void sculpt_radialcontrol_start(int mode);
struct Brush *sculptmode_brush(void);
void do_symmetrical_brush_actions(struct BrushAction *a, short *, short *);
void do_symmetrical_brush_actions(struct SculptData *sd, struct BrushAction *a, short *, short *);
void sculptmode_update_tex(void);
char sculpt_modifiers_active(struct Object *ob);
void sculpt(void);
void set_sculptmode(void);
void sculpt(SculptData *sd);
/* Stroke */
void sculpt_stroke_new(const int max);
void sculpt_stroke_free();
void sculpt_stroke_add_point(const short x, const short y);
void sculpt_stroke_apply(struct BrushAction *);
void sculpt_stroke_apply_all(struct BrushAction *);
void sculpt_stroke_draw();
struct SculptStroke *sculpt_stroke_new(const int max);
void sculpt_stroke_free(struct SculptStroke *);
void sculpt_stroke_add_point(struct SculptStroke *, const short x, const short y);
void sculpt_stroke_apply(struct SculptData *sd, struct SculptStroke *, struct BrushAction *);
void sculpt_stroke_apply_all(struct SculptData *sd, struct SculptStroke *, struct BrushAction *);
/* Partial Mesh Visibility */
void sculptmode_pmv(int mode);

@ -58,31 +58,27 @@ typedef struct SculptStroke {
float offset;
} SculptStroke;
void sculpt_stroke_new(const int max)
SculptStroke *sculpt_stroke_new(const int max)
{
SculptSession *ss = sculpt_session();
ss->stroke = MEM_callocN(sizeof(SculptStroke), "SculptStroke");
ss->stroke->loc = MEM_callocN(sizeof(short) * 4 * max, "SculptStroke.loc");
ss->stroke->max = max;
ss->stroke->index = -1;
SculptStroke *stroke = MEM_callocN(sizeof(SculptStroke), "SculptStroke");
stroke->loc = MEM_callocN(sizeof(short) * 4 * max, "SculptStroke.loc");
stroke->max = max;
stroke->index = -1;
return stroke;
}
void sculpt_stroke_free()
void sculpt_stroke_free(SculptStroke *stroke)
{
SculptSession *ss = sculpt_session();
if(ss && ss->stroke) {
if(ss->stroke->loc) MEM_freeN(ss->stroke->loc);
if(ss->stroke->final_mem) MEM_freeN(ss->stroke->final_mem);
if(stroke) {
if(stroke->loc) MEM_freeN(stroke->loc);
if(stroke->final_mem) MEM_freeN(stroke->final_mem);
MEM_freeN(ss->stroke);
ss->stroke = NULL;
MEM_freeN(stroke);
}
}
void sculpt_stroke_add_point(const short x, const short y)
void sculpt_stroke_add_point(SculptStroke *stroke, const short x, const short y)
{
SculptStroke *stroke = sculpt_session()->stroke;
const int next = stroke->index + 1;
if(stroke->index == -1) {
@ -112,10 +108,8 @@ void sculpt_stroke_smooth(SculptStroke *stroke)
}
}
static void sculpt_stroke_create_final()
static void sculpt_stroke_create_final(SculptStroke *stroke)
{
SculptStroke *stroke = sculpt_session()->stroke;
if(stroke) {
StrokePoint *p, *pnext;
int i;
@ -178,9 +172,9 @@ float sculpt_stroke_final_length(SculptStroke *stroke)
}
/* If partial is nonzero, cuts off apply after that length has been processed */
static StrokePoint *sculpt_stroke_apply_generic(SculptStroke *stroke, struct BrushAction *a, const int partial)
static StrokePoint *sculpt_stroke_apply_generic(SculptData *sd, SculptStroke *stroke, struct BrushAction *a, const int partial)
{
const int sdspace = sculpt_data()->spacing;
const int sdspace = sd->spacing;
const short spacing = sdspace > 0 ? sdspace : 2;
const int dots = sculpt_stroke_final_length(stroke) / spacing;
int i;
@ -215,24 +209,23 @@ static StrokePoint *sculpt_stroke_apply_generic(SculptStroke *stroke, struct Bru
co[0] = p->x*v + p->next->x*u;
co[1] = p->y*v + p->next->y*u;
do_symmetrical_brush_actions(a, co, NULL);
do_symmetrical_brush_actions(sd, a, co, NULL);
}
return p ? p->next : NULL;
}
void sculpt_stroke_apply(struct BrushAction *a)
void sculpt_stroke_apply(SculptData *sd, SculptStroke *stroke, struct BrushAction *a)
{
SculptStroke *stroke = sculpt_session()->stroke;
/* TODO: make these values user-modifiable? */
const int partial_len = 100;
const int min_len = 200;
if(stroke) {
sculpt_stroke_create_final();
sculpt_stroke_create_final(stroke);
if(sculpt_stroke_final_length(stroke) > min_len) {
StrokePoint *p = sculpt_stroke_apply_generic(stroke, a, partial_len);
StrokePoint *p = sculpt_stroke_apply_generic(sd, stroke, a, partial_len);
/* Replace remaining values in stroke->loc with remaining stroke->final values */
stroke->index = -1;
@ -249,21 +242,18 @@ void sculpt_stroke_apply(struct BrushAction *a)
}
}
void sculpt_stroke_apply_all(struct BrushAction *a)
void sculpt_stroke_apply_all(SculptData *sd, SculptStroke *stroke, struct BrushAction *a)
{
SculptStroke *stroke = sculpt_session()->stroke;
sculpt_stroke_create_final();
sculpt_stroke_create_final(stroke);
if(stroke) {
sculpt_stroke_apply_generic(stroke, a, 0);
sculpt_stroke_apply_generic(sd, stroke, a, 0);
}
}
void sculpt_stroke_draw()
/* XXX: drawing goes elsewhere */
void sculpt_stroke_draw(SculptStroke *stroke)
{
SculptStroke *stroke = sculpt_session()->stroke;
if(stroke) {
StrokePoint *p;

@ -123,7 +123,60 @@ void ED_spacetypes_keymap(wmWindowManager *wm)
}
}
/* ****************************** space template *********************** */
/* ********************** custom drawcall api ***************** */
/* type */
#define REGION_DRAW_PRE 1
#define REGION_DRAW_POST 0
typedef struct RegionDrawCB {
struct RegionDrawCB *next, *prev;
void (*draw)(const struct bContext *, struct ARegion *);
int type;
} RegionDrawCB;
void *ED_region_draw_cb_activate(ARegionType *art,
void (*draw)(const struct bContext *, struct ARegion *),
int type)
{
RegionDrawCB *rdc= MEM_callocN(sizeof(RegionDrawCB), "RegionDrawCB");
BLI_addtail(&art->drawcalls, rdc);
rdc->draw= draw;
rdc->type= type;
return rdc;
}
void ED_region_draw_cb_exit(ARegionType *art, void *handle)
{
RegionDrawCB *rdc;
for(rdc= art->drawcalls.first; rdc; rdc= rdc->next) {
if(rdc==(RegionDrawCB *)handle) {
BLI_remlink(&art->drawcalls, rdc);
MEM_freeN(rdc);
return;
}
}
}
void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type)
{
RegionDrawCB *rdc;
for(rdc= ar->type->drawcalls.first; rdc; rdc= rdc->next) {
if(rdc->type==type)
rdc->draw(C, ar);
}
}
/* ********************* space template *********************** */
/* allocate and init some vars */
static SpaceLink *xxx_new(const bContext *C)

@ -128,7 +128,7 @@ static void do_file_buttons(bContext *C, void *arg, int event)
void file_draw_buttons(const bContext *C, ARegion *ar)
{
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
FileSelectParams* params = sfile->params;
FileSelectParams* params = ED_fileselect_get_params(sfile);
uiBlock *block;
int loadbutton;
char name[20];
@ -277,7 +277,7 @@ static int file_view_columns(SpaceFile* sfile, View2D *v2d)
void file_calc_previews(const bContext *C, ARegion *ar)
{
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
FileSelectParams* params = sfile->params;
FileSelectParams* params = ED_fileselect_get_params(sfile);
View2D *v2d= &ar->v2d;
int width=0, height=0;
int rows, columns;
@ -316,7 +316,7 @@ void file_calc_previews(const bContext *C, ARegion *ar)
void file_draw_previews(const bContext *C, ARegion *ar)
{
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
FileSelectParams* params=sfile->params;
FileSelectParams* params= ED_fileselect_get_params(sfile);
View2D *v2d= &ar->v2d;
static double lasttime= 0;
struct FileList* files = sfile->files;
@ -471,7 +471,7 @@ void file_draw_previews(const bContext *C, ARegion *ar)
void file_draw_list(const bContext *C, ARegion *ar)
{
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
FileSelectParams* params = sfile->params;
FileSelectParams* params = ED_fileselect_get_params(sfile);
struct FileList* files = sfile->files;
struct direntry *file;
int numfiles;
@ -558,7 +558,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
void file_draw_fsmenu(const bContext *C, ARegion *ar)
{
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
FileSelectParams* params = sfile->params;
FileSelectParams* params = ED_fileselect_get_params(sfile);
char bookmark[FILE_MAX];
int nentries = fsmenu_get_nentries();
int linestep = U.fontsize*3/2;

@ -117,7 +117,7 @@ void file_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= CTX_wm_area(C);
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
FileSelectParams* params = sfile->params;
FileSelectParams* params = ED_fileselect_get_params(sfile);
uiBlock *block;
int xco, yco= 3;

@ -116,7 +116,7 @@ static void set_active_file(SpaceFile *sfile, FileSelectParams* params, struct A
}
static void set_active_bookmark(SpaceFile *sfile, FileSelectParams* params, struct ARegion* ar, short y)
static void set_active_bookmark(FileSelectParams* params, struct ARegion* ar, short y)
{
int nentries = fsmenu_get_nentries();
short posy = ar->v2d.mask.ymax - TILE_BORDER_Y - y;
@ -187,7 +187,7 @@ static void mouse_select_bookmark(SpaceFile* sfile, ARegion* ar, short *mval)
if(mval[0]>ar->v2d.mask.xmin && mval[0]<ar->v2d.mask.xmax
&& mval[1]>ar->v2d.mask.ymin && mval[1]<ar->v2d.mask.ymax) {
char *selected;
set_active_bookmark(sfile, sfile->params, ar, mval[1]);
set_active_bookmark(sfile->params, ar, mval[1]);
selected= fsmenu_get_entry(sfile->params->active_bookmark);
/* which string */
if (selected) {

@ -76,15 +76,26 @@
#include "filelist.h"
short ED_fileselect_set_params(FileSelectParams *params, int type, const char *title, const char *path,
FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile)
{
if (!sfile->params) {
ED_fileselect_set_params(sfile, FILE_UNIX, "", "/", 0, 0, 0);
}
return sfile->params;
}
short ED_fileselect_set_params(SpaceFile *sfile, int type, const char *title, const char *path,
short flag, short display, short filter)
{
char name[FILE_MAX], dir[FILE_MAX], file[FILE_MAX];
FileSelectParams *params;
if (!params) {
return 0;
if (!sfile->params) {
sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams");
}
params = sfile->params;
params->type = type;
params->flag = flag;
params->display = display;
@ -115,3 +126,9 @@ short ED_fileselect_set_params(FileSelectParams *params, int type, const char *t
return 1;
}
void ED_fileselect_reset_params(SpaceFile *sfile)
{
sfile->params->type = FILE_UNIX;
sfile->params->flag = 0;
sfile->params->title[0] = '\0';
}

@ -74,13 +74,7 @@ static SpaceLink *file_new(const bContext *C)
SpaceFile *sfile;
sfile= MEM_callocN(sizeof(SpaceFile), "initfile");
sfile->spacetype= SPACE_FILE;
sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams");
sfile->files = filelist_new();
ED_fileselect_set_params(sfile->params, FILE_UNIX, "", "/", 0, 0, 0);
filelist_setdir(sfile->files, sfile->params->dir);
filelist_settype(sfile->files, sfile->params->type);
sfile->spacetype= SPACE_FILE;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for file");
@ -122,14 +116,14 @@ static void file_free(SpaceLink *sl)
filelist_free(sfile->files);
filelist_freelib(sfile->files);
MEM_freeN(sfile->files);
sfile->files = 0;
sfile->files= NULL;
}
if (sfile->params) {
if(sfile->params->pupmenu)
MEM_freeN(sfile->params->pupmenu);
MEM_freeN(sfile->params);
sfile->params = 0;
sfile->params= NULL;
}
if (sfile->op) {
@ -142,16 +136,15 @@ static void file_free(SpaceLink *sl)
static void file_init(struct wmWindowManager *wm, ScrArea *sa)
{
SpaceFile *sfile= sa->spacedata.first; /* XXX get through context? */
if (!sfile->params) {
sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams");
ED_fileselect_set_params(sfile->params, FILE_UNIX, "", "/", 0, 0, 0);
if (sfile->params) {
ED_fileselect_reset_params(sfile);
}
if (!sfile->files) {
sfile->files = filelist_new();
if (sfile->files) {
filelist_free(sfile->files);
filelist_freelib(sfile->files);
MEM_freeN(sfile->files);
sfile->files= NULL;
}
filelist_setdir(sfile->files, sfile->params->dir);
filelist_settype(sfile->files, sfile->params->type);
}
static SpaceLink *file_duplicate(SpaceLink *sl)
@ -165,9 +158,10 @@ static SpaceLink *file_duplicate(SpaceLink *sl)
sfilen->params= MEM_dupallocN(sfileo->params);
if (!sfilen->params) {
sfilen->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams");
ED_fileselect_set_params(sfilen->params, FILE_UNIX, "", "/", 0, 0, 0);
ED_fileselect_set_params(sfilen, FILE_UNIX, "", "/", 0, 0, 0);
sfilen->params->pupmenu = NULL;
}
sfilen->files = filelist_new();
filelist_setdir(sfilen->files, sfilen->params->dir);
filelist_settype(sfilen->files, sfilen->params->type);

@ -0,0 +1,713 @@
/**
* $Id: drawipo.c 17512 2008-11-20 05:55:42Z aligorith $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) Blender Foundation
*
* Contributor(s): Joshua Leung (2009 Recode)
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef _WIN32
#include <unistd.h>
#else
#include <io.h>
#endif
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_sequence_types.h"
#include "DNA_userdef_types.h"
#include "DNA_view2d_types.h"
#include "DNA_windowmanager_types.h"
#include "BKE_curve.h"
#include "BKE_depsgraph.h"
#include "BKE_ipo.h"
#include "BKE_key.h"
#include "BKE_object.h"
#include "BKE_utildefines.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "ED_anim_api.h"
#include "ED_util.h"
#include "UI_resources.h"
#include "UI_view2d.h"
/* **************************** */
// XXX stubs to remove!
// NOTE: the code in this file has yet to be rewritten to get rid of the editipo system which is past its use-by-date - Aligorith
typedef struct EditIpo {
IpoCurve *icu;
short disptype;
short flag;
unsigned int col;
} EditIpo;
#define ISPOIN(a, b, c) ( (a->b) && (a->c) )
#define ISPOIN3(a, b, c, d) ( (a->b) && (a->c) && (a->d) )
#define ISPOIN4(a, b, c, d, e) ( (a->b) && (a->c) && (a->d) && (a->e) )
/* *************************** */
/* helper func - draw keyframe vertices only for an IPO-curve */
static void draw_ipovertices_keyframes(IpoCurve *icu, View2D *v2d, short disptype, short edit, short sel)
{
BezTriple *bezt= icu->bezt;
float v1[2];
int a, b;
bglBegin(GL_POINTS);
for (a = 0; a < icu->totvert; a++, bezt++) {
/* IPO_DISPBITS is used for displaying curves for bitflag variables */
if (disptype == IPO_DISPBITS) {
/*if (v2d->cur.xmin < bezt->vec[1][0] < v2d->cur.xmax) {*/
short ok= 0;
if (edit) {
if ((bezt->f2 & SELECT) == sel)
ok= 1;
}
else ok= 1;
if (ok) {
int val= (int)bezt->vec[1][1];
v1[0]= bezt->vec[1][0];
for (b= 0; b < 31; b++) {
if (val & (1<<b)) {
v1[1]= b + 1;
bglVertex3fv(v1);
}
}
}
/*}*/
}
else { /* normal (non bit) curves */
if (edit) {
/* Only the vertex of the line, the
* handler are drawn later
*/
if ((bezt->f2 & SELECT) == sel) /* && G.v2d->cur.xmin < bezt->vec[1][0] < G.v2d->cur.xmax)*/
bglVertex3fv(bezt->vec[1]);
}
else {
/* draw only if in bounds */
/*if (G.v2d->cur.xmin < bezt->vec[1][0] < G.v2d->cur.xmax)*/
bglVertex3fv(bezt->vec[1]);
}
}
}
bglEnd();
}
/* helper func - draw handle vertex for an IPO-Curve as a round unfilled circle */
static void draw_ipohandle_control(float x, float y, float xscale, float yscale, float hsize)
{
static GLuint displist=0;
/* initialise round circle shape */
if (displist == 0) {
GLUquadricObj *qobj;
displist= glGenLists(1);
glNewList(displist, GL_COMPILE_AND_EXECUTE);
qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
gluDisk(qobj, 0.07, 0.8, 12, 1);
gluDeleteQuadric(qobj);
glEndList();
}
/* adjust view transform before starting */
glTranslatef(x, y, 0.0f);
glScalef(1.0/xscale*hsize, 1.0/yscale*hsize, 1.0);
/* draw! */
glCallList(displist);
/* restore view transform */
glScalef(xscale/hsize, yscale/hsize, 1.0);
glTranslatef(-x, -y, 0.0f);
}
/* helper func - draw handle vertices only for an IPO-curve (if it is in EditMode) */
static void draw_ipovertices_handles(IpoCurve *icu, View2D *v2d, short disptype, short sel)
{
BezTriple *bezt= icu->bezt;
BezTriple *prevbezt = NULL;
float hsize, xscale, yscale;
int a;
/* get view settings */
hsize= UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE);
UI_view2d_getscale(v2d, &xscale, &yscale);
/* set handle color */
if (sel) UI_ThemeColor(TH_HANDLE_VERTEX_SELECT);
else UI_ThemeColor(TH_HANDLE_VERTEX);
for (a= 0; a < icu->totvert; a++, prevbezt=bezt, bezt++) {
if (disptype != IPO_DISPBITS) {
if (ELEM(icu->ipo, IPO_BEZ, IPO_MIXED)) {
/* Draw the editmode handels for a bezier curve (others don't have handles)
* if their selection status matches the selection status we're drawing for
* - first handle only if previous beztriple was bezier-mode
* - second handle only if current beztriple is bezier-mode
*/
if ( (!prevbezt && (bezt->ipo==IPO_BEZ)) || (prevbezt && (prevbezt->ipo==IPO_BEZ)) ) {
if ((bezt->f1 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/
draw_ipohandle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize);
}
if (bezt->ipo==IPO_BEZ) {
if ((bezt->f3 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax)*/
draw_ipohandle_control(bezt->vec[2][0], bezt->vec[2][1], xscale, yscale, hsize);
}
}
}
}
}
static void draw_ipovertices(SpaceIpo *sipo, ARegion *ar, int sel)
{
View2D *v2d= &ar->v2d;
EditIpo *ei= sipo->editipo;
int nr, val = 0;
/* this shouldn't get called while drawing in selection-buffer anyway */
//if (G.f & G_PICKSEL) return;
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
for (nr=0; nr<sipo->totipo; nr++, ei++) {
if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
/* select colors to use to draw keyframes */
if (sipo->showkey) {
if (sel) UI_ThemeColor(TH_TEXT_HI);
else UI_ThemeColor(TH_TEXT);
}
else if (ei->flag & IPO_EDIT) {
if (sel) UI_ThemeColor(TH_VERTEX_SELECT);
else UI_ThemeColor(TH_VERTEX);
}
else {
if (sel) UI_ThemeColor(TH_TEXT_HI);
else UI_ThemeColor(TH_TEXT);
val= (ei->icu->flag & IPO_SELECT)!=0;
if (sel != val) continue;
}
/* We can't change the color in the middle of
* GL_POINTS because then Blender will segfault
* on TNT2 / Linux with NVidia's drivers
* (at least up to ver. 4349)
*/
/* draw keyframes, then the handles (if in editmode) */
draw_ipovertices_keyframes(ei->icu, v2d, ei->disptype, (ei->flag & IPO_EDIT), sel);
/* Now draw the two vertex of the handles,
* This needs to be done after the keyframes,
* because we can't call glPointSize
* in the middle of a glBegin/glEnd also the
* bug comment before.
*/
if ((ei->flag & IPO_EDIT) && (sipo->flag & SIPO_NOHANDLES)==0)
draw_ipovertices_handles(ei->icu, v2d, ei->disptype, sel);
}
}
glPointSize(1.0);
}
/* draw lines for IPO-curve handles only (this is only done in EditMode) */
static void draw_ipohandles(SpaceIpo *sipo, ARegion *ar, int sel)
{
EditIpo *ei;
extern unsigned int nurbcol[];
unsigned int *col;
int a, b;
/* don't draw handle lines if handles are not shown */
if (sipo->flag & SIPO_NOHANDLES)
return;
if (sel) col= nurbcol+4;
else col= nurbcol;
ei= sipo->editipo;
for (a=0; a<sipo->totipo; a++, ei++) {
if ISPOIN4(ei, flag & IPO_VISIBLE, flag & IPO_EDIT, icu, disptype!=IPO_DISPBITS) {
if (ELEM(ei->icu->ipo, IPO_BEZ, IPO_MIXED)) {
BezTriple *bezt=ei->icu->bezt, *prevbezt=NULL;
float *fp;
for (b= 0; b < ei->icu->totvert; b++, prevbezt=bezt, bezt++) {
if ((bezt->f2 & SELECT)==sel) {
fp= bezt->vec[0];
/* only draw first handle if previous segment had handles */
if ( (!prevbezt && (bezt->ipo==IPO_BEZ)) || (prevbezt && (prevbezt->ipo==IPO_BEZ)) )
{
cpack(col[bezt->h1]);
glBegin(GL_LINE_STRIP);
glVertex2fv(fp); glVertex2fv(fp+3);
glEnd();
}
/* only draw second handle if this segment is bezier */
if (bezt->ipo == IPO_BEZ)
{
cpack(col[bezt->h2]);
glBegin(GL_LINE_STRIP);
glVertex2fv(fp+3); glVertex2fv(fp+6);
glEnd();
}
}
else {
/* only draw first handle if previous segment was had handles, and selection is ok */
if ( ((bezt->f1 & SELECT)==sel) &&
( (!prevbezt && (bezt->ipo==IPO_BEZ)) || (prevbezt && (prevbezt->ipo==IPO_BEZ)) ) )
{
fp= bezt->vec[0];
cpack(col[bezt->h1]);
glBegin(GL_LINE_STRIP);
glVertex2fv(fp); glVertex2fv(fp+3);
glEnd();
}
/* only draw second handle if this segment is bezier, and selection is ok */
if ( ((bezt->f3 & SELECT)==sel) &&
(bezt->ipo == IPO_BEZ) )
{
fp= bezt->vec[1];
cpack(col[bezt->h2]);
glBegin(GL_LINE_STRIP);
glVertex2fv(fp); glVertex2fv(fp+3);
glEnd();
}
}
}
}
}
}
}
/* helper func - draw one repeat of an ipo-curve: bitflag curve only (this is evil stuff to expose to user like this) */
static void draw_ipocurve_repeat_bits (IpoCurve *icu, View2D *v2d, float cycxofs)
{
BezTriple *bezt= icu->bezt;
int a;
/* loop over each keyframe, drawing a line extending from that point */
for (a=0, bezt=icu->bezt; a < icu->totvert; a++, bezt++) {
int val= (int)bezt->vec[1][1];
int b= 0;
/* for each bit in the int, draw a line if the keyframe incorporates it */
for (b = 0; b < 31; b++) {
if (val & (1<<b)) {
float v1[2];
/* value stays constant */
v1[1]= b+1;
glBegin(GL_LINE_STRIP);
/* extend left too if first keyframe, and not cyclic extrapolation */
if ((a == 0) && !(icu->extrap & IPO_CYCL)) {
v1[0]= v2d->cur.xmin+cycxofs;
glVertex2fv(v1);
}
/* must pass through current keyframe */
v1[0]= bezt->vec[1][0] + cycxofs;
glVertex2fv(v1);
/* 1. if there is a next keyframe, extend until then OR
* 2. extend until 'infinity' if not cyclic extrapolation
*/
if ((a+1) < icu->totvert) v1[0]= (bezt+1)->vec[1][0]+cycxofs;
else if ((icu->extrap & IPO_CYCL)==0) v1[0]= v2d->cur.xmax+cycxofs;
glVertex2fv(v1);
glEnd();
}
}
}
}
/* helper func - draw one repeat of an ipo-curve: normal curve */
static void draw_ipocurve_repeat_normal (IpoCurve *icu, View2D *v2d, float cycxofs, float cycyofs, float *facp)
{
BezTriple *prevbezt= icu->bezt;
BezTriple *bezt= prevbezt+1;
float v1[2], v2[2], v3[2], v4[2];
float *fp, data[120];
float fac= *(facp);
int b= icu->totvert-1;
int resol;
glBegin(GL_LINE_STRIP);
/* extrapolate to left? */
if ((icu->extrap & IPO_CYCL)==0) {
/* left-side of view comes before first keyframe, so need to extend as not cyclic */
if (prevbezt->vec[1][0] > v2d->cur.xmin) {
v1[0]= v2d->cur.xmin;
/* y-value depends on the interpolation */
if ((icu->extrap==IPO_HORIZ) || (prevbezt->ipo==IPO_CONST) || (icu->totvert==1)) {
/* just extend across the first keyframe's value */
v1[1]= prevbezt->vec[1][1];
}
else if (prevbezt->ipo==IPO_LIN) {
/* extrapolate linear dosnt use the handle, use the next points center instead */
fac= (prevbezt->vec[1][0]-bezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
if (fac) fac= 1.0f/fac;
v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[1][1]-bezt->vec[1][1]);
}
else {
/* based on angle of handle 1 (relative to keyframe) */
fac= (prevbezt->vec[0][0]-prevbezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
if (fac) fac= 1.0f/fac;
v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[0][1]-prevbezt->vec[1][1]);
}
glVertex2fv(v1);
}
}
/* if only one keyframe, add it now */
if (icu->totvert == 1) {
v1[0]= prevbezt->vec[1][0] + cycxofs;
v1[1]= prevbezt->vec[1][1] + cycyofs;
glVertex2fv(v1);
}
/* draw curve between first and last keyframe (if there are enough to do so) */
while (b--) {
if (prevbezt->ipo==IPO_CONST) {
/* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */
v1[0]= prevbezt->vec[1][0]+cycxofs;
v1[1]= prevbezt->vec[1][1]+cycyofs;
glVertex2fv(v1);
v1[0]= bezt->vec[1][0]+cycxofs;
v1[1]= prevbezt->vec[1][1]+cycyofs;
glVertex2fv(v1);
}
else if (prevbezt->ipo==IPO_LIN) {
/* Linear interpolation: just add one point (which should add a new line segment) */
v1[0]= prevbezt->vec[1][0]+cycxofs;
v1[1]= prevbezt->vec[1][1]+cycyofs;
glVertex2fv(v1);
}
else {
/* Bezier-Interpolation: draw curve as series of segments between keyframes
* - resol determines number of points to sample in between keyframes
*/
/* resol not depending on horizontal resolution anymore, drivers for example... */
if (icu->driver)
resol= 32;
else
resol= 3.0*sqrt(bezt->vec[1][0] - prevbezt->vec[1][0]);
if (resol < 2) {
/* only draw one */
v1[0]= prevbezt->vec[1][0]+cycxofs;
v1[1]= prevbezt->vec[1][1]+cycyofs;
glVertex2fv(v1);
}
else {
/* clamp resolution to max of 32 */
if (resol > 32) resol= 32;
v1[0]= prevbezt->vec[1][0]+cycxofs;
v1[1]= prevbezt->vec[1][1]+cycyofs;
v2[0]= prevbezt->vec[2][0]+cycxofs;
v2[1]= prevbezt->vec[2][1]+cycyofs;
v3[0]= bezt->vec[0][0]+cycxofs;
v3[1]= bezt->vec[0][1]+cycyofs;
v4[0]= bezt->vec[1][0]+cycxofs;
v4[1]= bezt->vec[1][1]+cycyofs;
correct_bezpart(v1, v2, v3, v4);
forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, 3);
forward_diff_bezier(v1[1], v2[1], v3[1], v4[1], data+1, resol, 3);
for (fp= data; resol; resol--, fp+= 3)
glVertex2fv(fp);
}
}
/* get next pointers */
prevbezt= bezt;
bezt++;
/* last point? */
if (b == 0) {
v1[0]= prevbezt->vec[1][0]+cycxofs;
v1[1]= prevbezt->vec[1][1]+cycyofs;
glVertex2fv(v1);
}
}
/* extrapolate to right? (see code for left-extrapolation above too) */
if ((icu->extrap & IPO_CYCL)==0) {
if (prevbezt->vec[1][0] < v2d->cur.xmax) {
v1[0]= v2d->cur.xmax;
/* y-value depends on the interpolation */
if ((icu->extrap==IPO_HORIZ) || (prevbezt->ipo==IPO_CONST) || (icu->totvert==1)) {
/* based on last keyframe's value */
v1[1]= prevbezt->vec[1][1];
}
else if (prevbezt->ipo==IPO_LIN) {
/* extrapolate linear dosnt use the handle, use the previous points center instead */
bezt = prevbezt-1;
fac= (prevbezt->vec[1][0]-bezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
if (fac) fac= 1.0f/fac;
v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[1][1]-bezt->vec[1][1]);
}
else {
/* based on angle of handle 1 (relative to keyframe) */
fac= (prevbezt->vec[2][0]-prevbezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
if (fac) fac= 1.0f/fac;
v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[2][1]-prevbezt->vec[1][1]);
}
glVertex2fv(v1);
}
}
glEnd();
/* return fac, as we alter it */
*(facp) = fac;
}
/* draw all ipo-curves */
static void draw_ipocurves(SpaceIpo *sipo, ARegion *ar, int sel)
{
View2D *v2d= &ar->v2d;
EditIpo *ei;
int nr, val/*, pickselcode=0*/;
/* if we're drawing for GL_SELECT, reset pickselcode first
* - there's only one place that will do this, so it should be fine
*/
//if (G.f & G_PICKSEL)
// pickselcode= 1;
ei= sipo->editipo;
for (nr=0; nr<sipo->totipo; nr++, ei++) {
if ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt) {
/* val is used to indicate if curve can be edited */
//if (G.f & G_PICKSEL) {
// /* when using OpenGL to select stuff (on mouseclick) */
// glLoadName(pickselcode++);
// val= 1;
//}
//else {
/* filter to only draw those that are selected or unselected (based on drawing mode */
val= (ei->flag & (IPO_SELECT+IPO_EDIT)) != 0;
val= (val==sel);
//}
/* only draw those curves that we can draw */
if (val) {
IpoCurve *icu= ei->icu;
float cycdx=0.0f, cycdy=0.0f, cycxofs=0.0f, cycyofs=0.0f;
const int lastindex= (icu->totvert-1);
float fac= 0.0f;
int cycount=1;
/* set color for curve curve:
* - bitflag curves (evil) must always be drawn coloured as they cannot work with IPO-Keys
* - when IPO-Keys are shown, individual curves are not editable, so we show by drawing them all black
*/
if ((sipo->showkey) && (ei->disptype!=IPO_DISPBITS)) UI_ThemeColor(TH_TEXT);
else cpack(ei->col);
/* cyclic curves - get offset and number of repeats to display */
if (icu->extrap & IPO_CYCL) {
BezTriple *bezt= icu->bezt;
BezTriple *lastbezt= bezt + lastindex;
/* calculate cycle length and amplitude */
cycdx= lastbezt->vec[1][0] - bezt->vec[1][0];
cycdy= lastbezt->vec[1][1] - bezt->vec[1][1];
/* check that the cycle does have some length */
if (cycdx > 0.01f) {
/* count cycles before first frame */
while (icu->bezt->vec[1][0]+cycxofs > v2d->cur.xmin) {
cycxofs -= cycdx;
if (icu->extrap & IPO_DIR) cycyofs-= cycdy;
cycount++;
}
/* count cycles after last frame (and adjust offset) */
fac= 0.0f;
while (lastbezt->vec[1][0]+fac < v2d->cur.xmax) {
cycount++;
fac += cycdx;
}
}
}
/* repeat process for each repeat */
while (cycount--) {
/* bitflag curves are drawn differently to normal curves */
if (ei->disptype==IPO_DISPBITS)
draw_ipocurve_repeat_bits(icu, v2d, cycxofs);
else
draw_ipocurve_repeat_normal(icu, v2d, cycxofs, cycyofs, &fac);
/* prepare for next cycle by adjusing offsets */
cycxofs += cycdx;
if (icu->extrap & IPO_DIR) cycyofs += cycdy;
}
/* vertical line that indicates the end of a speed curve */
if ((sipo->blocktype==ID_CU) && (icu->adrcode==CU_SPEED)) {
int b= icu->totvert-1;
if (b) {
BezTriple *bezt= icu->bezt+b;
glColor3ub(0, 0, 0);
glBegin(GL_LINES);
glVertex2f(bezt->vec[1][0], 0.0f);
glVertex2f(bezt->vec[1][0], bezt->vec[1][1]);
glEnd();
}
}
}
}
}
}
#if 0
static void draw_ipokey(SpaceIpo *sipo, ARegion *ar)
{
View2D *v2d= &ar->v2d;
IpoKey *ik;
glBegin(GL_LINES);
for (ik= sipo->ipokey.first; ik; ik= ik->next) {
if (ik->flag & SELECT) glColor3ub(0xFF, 0xFF, 0x99);
else glColor3ub(0xAA, 0xAA, 0x55);
glVertex2f(ik->val, v2d->cur.ymin);
glVertex2f(ik->val, v2d->cur.ymax);
}
glEnd();
}
#endif
void drawipospace(ScrArea *sa, ARegion *ar)
{
SpaceIpo *sipo= sa->spacedata.first;
//View2D *v2d= &ar->v2d;
EditIpo *ei;
if(sipo->editipo) {
/* correct scale for degrees? */
// XXX this should be calculated elsewhere
#if 0
disptype= -1;
ei= sipo->editipo;
for(a=0; a<sipo->totipo; a++, ei++) {
if(ei->flag & IPO_VISIBLE) {
if(disptype== -1) disptype= ei->disptype;
else if(disptype!=ei->disptype) disptype= 0;
}
}
#endif
// now set grid size (done elsehwere now)
/* ipokeys */
#if 0
if(sipo->showkey) {
//if(sipo->ipokey.first==0) make_ipokey();
//else update_ipokey_val();
make_ipokey();
draw_ipokey(sipo);
}
#endif
/* map ipo-points for drawing if scaled ipo */
//if (NLA_IPO_SCALED)
// ANIM_nla_mapping_apply_ipo(OBACT, sipo->ipo, 0, 0);
/* draw deselect */
draw_ipocurves(sipo, ar, 0);
draw_ipohandles(sipo, ar, 0);
draw_ipovertices(sipo, ar, 0);
/* draw select */
draw_ipocurves(sipo, ar, 1);
draw_ipohandles(sipo, ar, 1);
draw_ipovertices(sipo, ar, 1);
/* undo mapping of ipo-points for drawing if scaled ipo */
//if (NLA_IPO_SCALED)
// ANIM_nla_mapping_apply_ipo(OBACT, sipo->ipo, 1, 0);
}
}

@ -99,7 +99,6 @@ static void node_mouse_select(SpaceNode *snode, ARegion *ar, short *mval, short
;// node_link_viewer(snode, node);
//std_rmouse_transform(node_transform_ext); /* does undo push for select */
ED_region_tag_redraw(ar);
}
}
@ -121,6 +120,9 @@ static int node_select_exec(bContext *C, wmOperator *op)
node_mouse_select(snode, ar, mval, extend);
break;
}
WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); /* Do we need to pass the scene? */
return OPERATOR_FINISHED;
}
@ -227,6 +229,8 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
}
}
WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); /* Do we need to pass the scene? */
return OPERATOR_FINISHED;
}

@ -1357,7 +1357,7 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
else if(soops->outlinevis==SO_USERDEF) {
PointerRNA userdefptr;
RNA_pointer_create(NULL, NULL, &RNA_UserPreferences, &U, &userdefptr);
RNA_pointer_create(NULL, &RNA_UserPreferences, &U, &userdefptr);
ten= outliner_add_element(soops, &soops->tree, (void*)&userdefptr, NULL, TSE_RNA_STRUCT, -1);

@ -3480,8 +3480,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, Base *base, Part
psys->flag &= ~PSYS_DRAWING;
if(psys->lattice){
end_latt_deform();
psys->lattice=0;
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
wmLoadMatrix(v3d->viewmat);

@ -181,15 +181,6 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
return (SpaceLink *)v3dn;
}
static void view3d_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first; /* XXX get from region */
drawview3dspace(CTX_wm_screen(C), CTX_data_scene(C), ar, v3d);
}
/* add handlers, stuff you only do once or on area/region changes */
static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
{

@ -51,6 +51,7 @@
#include "BLI_rand.h"
#include "BKE_anim.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_image.h"
#include "BKE_ipo.h"
@ -76,6 +77,7 @@
#include "ED_keyframing.h"
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_util.h"
#include "ED_types.h"
@ -1835,10 +1837,11 @@ static CustomDataMask get_viewedit_datamask(bScreen *screen)
return mask;
}
void drawview3dspace(bScreen *screen, Scene *scene, ARegion *ar, View3D *v3d)
void view3d_main_area_draw(const bContext *C, ARegion *ar)
{
Scene *scene= CTX_data_scene(C);
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first; /* XXX get from region */
Scene *sce;
Base *base;
Object *ob;
@ -1846,7 +1849,7 @@ void drawview3dspace(bScreen *screen, Scene *scene, ARegion *ar, View3D *v3d)
Object *obact = OBACT;
/* from now on all object derived meshes check this */
v3d->customdata_mask= get_viewedit_datamask(screen);
v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C));
/* update all objects, ipos, matrices, displists, etc. Flags set by depgraph or manual,
no layer check here, gets correct flushed */
@ -1999,12 +2002,7 @@ void drawview3dspace(bScreen *screen, Scene *scene, ARegion *ar, View3D *v3d)
view3d_update_depths(ar, v3d);
}
if(G.moving) {
// BIF_drawConstraint();
// if(obedit || (G.f & G_PARTICLEEDIT))
// BIF_drawPropCircle(); // only editmode and particles have proportional edit
// BIF_drawSnap();
}
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST);
// REEB_draw();

@ -69,6 +69,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_types.h"
@ -96,6 +97,7 @@ typedef struct ViewOpsData {
int origx, origy, oldx, oldy;
int origkey;
void *vh; // XXX temp
} ViewOpsData;
#define TRACKBALLSIZE (1.1)
@ -362,6 +364,10 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
default:
if(event->type==vod->origkey && event->val==0) {
if(vod->vh) {
ED_region_draw_cb_exit(CTX_wm_region(C)->type, vod->vh);
ED_region_tag_redraw(CTX_wm_region(C));
}
MEM_freeN(vod);
op->customdata= NULL;
@ -372,6 +378,12 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
static void vh_draw(const bContext *C, ARegion *ar)
{
glColor3ub(100, 200, 100);
glRectf(-0.2, -0.2, 0.2, 0.2);
}
static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ViewOpsData *vod;
@ -380,6 +392,8 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
viewops_data(C, op, event);
vod= op->customdata;
vod->vh= ED_region_draw_cb_activate(CTX_wm_region(C)->type, vh_draw, REGION_DRAW_POST);
/* switch from camera view when: */
if(vod->v3d->persp != V3D_PERSP) {
@ -1344,41 +1358,6 @@ void VIEW3D_OT_drawtype(wmOperatorType *ot)
/* ********************************************************* */
void set_render_border(Scene *scene, ARegion *ar, View3D *v3d)
{
rcti rect;
short val;
val= 0; // XXX get_border(&rect, 3);
if(val) {
rctf vb;
calc_viewborder(scene, ar, v3d, &vb);
scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin);
scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
scene->r.border.xmax= ((float)rect.xmax-vb.xmin)/(vb.xmax-vb.xmin);
scene->r.border.ymax= ((float)rect.ymax-vb.ymin)/(vb.ymax-vb.ymin);
CLAMP(scene->r.border.xmin, 0.0, 1.0);
CLAMP(scene->r.border.ymin, 0.0, 1.0);
CLAMP(scene->r.border.xmax, 0.0, 1.0);
CLAMP(scene->r.border.ymax, 0.0, 1.0);
/* drawing a border surrounding the entire camera view switches off border rendering
* or the border covers no pixels */
if ((scene->r.border.xmin <= 0.0 && scene->r.border.xmax >= 1.0 &&
scene->r.border.ymin <= 0.0 && scene->r.border.ymax >= 1.0) ||
(scene->r.border.xmin == scene->r.border.xmax ||
scene->r.border.ymin == scene->r.border.ymax ))
{
scene->r.mode &= ~R_BORDER;
} else {
scene->r.mode |= R_BORDER;
}
}
}
void view3d_border_zoom(Scene *scene, ARegion *ar, View3D *v3d)
{

@ -136,6 +136,25 @@ static int retopo_mesh_paint_check() {return 0;}
/* end XXX ************* */
/* well... in this file a lot of view mode manipulation happens, so let's have it defined here */
void ED_view3d_exit_paint_modes(bContext *C)
{
if(G.f & G_VERTEXPAINT)
WM_operator_name_call(C, "VIEW3D_OT_vpaint_toggle", WM_OP_EXEC_REGION_WIN, NULL, NULL);
// if(G.f & G_TEXTUREPAINT) set_texturepaint();
// if(G.f & G_WEIGHTPAINT) set_wpaint();
// if(G.f & G_SCULPTMODE) set_sculptmode();
// if(G.f & G_PARTICLEEDIT) PE_set_particle_edit();
G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE+G_PARTICLEEDIT);
}
static void do_view3d_buttons(bContext *C, void *arg, int event);
#define B_SCENELOCK 101
@ -5368,7 +5387,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
if (v3d->modeselect == V3D_OBJECTMODE_SEL) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
ED_view3d_exit_paint_modes(C);
ED_armature_exit_posemode(basact);
if(obedit)
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
@ -5376,7 +5395,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
else if (v3d->modeselect == V3D_EDITMODE_SEL) {
if(!obedit) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
ED_view3d_exit_paint_modes(C);
ED_object_enter_editmode(C, EM_WAITCURSOR);
ED_undo_push(C, "Original"); /* here, because all over code enter_editmode is abused */
}
@ -5384,7 +5403,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
else if (v3d->modeselect == V3D_SCULPTMODE_SEL) {
if (!(G.f & G_SCULPTMODE)) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
ED_view3d_exit_paint_modes(C);
if(obedit) ED_object_exit_editmode(C, EM_FREEUNDO); /* exit editmode and undo */
// XXX set_sculptmode();
@ -5393,16 +5412,16 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
else if (v3d->modeselect == V3D_VERTEXPAINTMODE_SEL) {
if (!(G.f & G_VERTEXPAINT)) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
ED_view3d_exit_paint_modes(C);
if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
// XXX set_vpaint();
WM_operator_name_call(C, "VIEW3D_OT_vpaint_toggle", WM_OP_EXEC_REGION_WIN, NULL, NULL);
}
}
else if (v3d->modeselect == V3D_TEXTUREPAINTMODE_SEL) {
if (!(G.f & G_TEXTUREPAINT)) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
ED_view3d_exit_paint_modes(C);
if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
// XXX set_texturepaint();
@ -5411,7 +5430,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
else if (v3d->modeselect == V3D_WEIGHTPAINTMODE_SEL) {
if (!(G.f & G_WEIGHTPAINT) && (ob && ob->type == OB_MESH) ) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
ED_view3d_exit_paint_modes(C);
if(obedit)
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
@ -5431,7 +5450,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
else if(v3d->modeselect == V3D_PARTICLEEDITMODE_SEL){
if (!(G.f & G_PARTICLEEDIT)) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
ED_view3d_exit_paint_modes(C);
if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
// XXX PE_set_particle_edit();

@ -33,6 +33,7 @@
/* internal exports only */
struct bScreen;
struct ARegion;
struct BoundBox;
struct Object;
struct DerivedMesh;
@ -64,7 +65,7 @@ typedef struct ViewDepths {
#define IS_CLIPPED 12000
/* view3d_header.c */
void view3d_header_buttons(const struct bContext *C, ARegion *ar);
void view3d_header_buttons(const struct bContext *C, struct ARegion *ar);
/* view3d_ops.c */
void view3d_operatortypes(void);
@ -83,7 +84,7 @@ void VIEW3D_OT_render_border(struct wmOperatorType *ot);
void VIEW3D_OT_drawtype(struct wmOperatorType *ot);
/* drawobject.c */
void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag);
void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int flag);
int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt);
void drawcircball(int mode, float *cent, float rad, float tmat[][4]);
void draw_object_instance(Scene *scene, View3D *v3d, Object *ob, int dt, int outline);
@ -97,17 +98,17 @@ int draw_armature(Scene *scene, View3D *v3d, Base *base, int dt, int flag);
void draw_mesh_textured(Scene *scene, View3D *v3d, Object *ob, struct DerivedMesh *dm, int faceselect);
/* view3d_draw.c */
void drawview3dspace(struct bScreen *screen, Scene *scene, ARegion *ar, View3D *v3d);
void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *));
void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);
void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (* func)(void *));
void view3d_clr_clipping(void);
void view3d_set_clipping(View3D *v3d);
void add_view3d_after(View3D *v3d, Base *base, int type, int flag);
void make_axis_color(char *col, char *col2, char axis);
void calc_viewborder(Scene *scene, ARegion *ar, View3D *v3d, rctf *viewborder_r);
void calc_viewborder(Scene *scene, struct ARegion *ar, View3D *v3d, rctf *viewborder_r);
void circf(float x, float y, float rad);
void circ(float x, float y, float rad);
void view3d_update_depths(ARegion *ar, View3D *v3d);
void view3d_update_depths(struct ARegion *ar, View3D *v3d);
/* view3d_select.c */
void VIEW3D_OT_select(struct wmOperatorType *ot);
@ -116,6 +117,12 @@ void VIEW3D_OT_circle_select(struct wmOperatorType *ot);
void VIEW3D_OT_borderselect(struct wmOperatorType *ot);
void VIEW3D_OT_lasso_select(struct wmOperatorType *ot);
void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc);
/* vpaint.c */
void VIEW3D_OT_vpaint_toggle(struct wmOperatorType *ot);
void VIEW3D_OT_vpaint(struct wmOperatorType *ot);
/* view3d_view.c */
void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
void VIEW3D_OT_setcameratoview(struct wmOperatorType *ot);
@ -124,19 +131,19 @@ void view3d_operator_needs_opengl(const struct bContext *C);
int boundbox_clip(View3D *v3d, float obmat[][4], struct BoundBox *bb);
void view3d_project_short_clip(ARegion *ar, View3D *v3d, float *vec, short *adr, float projmat[4][4], float wmat[4][4]);
void view3d_project_short_noclip(ARegion *ar, float *vec, short *adr, float mat[4][4]);
void view3d_project_float(ARegion *a, float *vec, float *adr, float mat[4][4]);
void view3d_project_short_clip(struct ARegion *ar, View3D *v3d, float *vec, short *adr, float projmat[4][4], float wmat[4][4]);
void view3d_project_short_noclip(struct ARegion *ar, float *vec, short *adr, float mat[4][4]);
void view3d_project_float(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
void view3d_get_object_project_mat(View3D *v3d, struct Object *ob, float pmat[4][4], float vmat[4][4]);
void view3d_project_float(ARegion *ar, float *vec, float *adr, float mat[4][4]);
void view3d_project_float(struct ARegion *ar, float *vec, float *adr, float mat[4][4]);
int get_view3d_viewplane(View3D *v3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
void initlocalview(Scene *scene, ARegion *ar, View3D *v3d);
void initlocalview(Scene *scene, struct ARegion *ar, View3D *v3d);
void restore_localviewdata(View3D *vd);
void endlocalview(Scene *scene, ScrArea *sa);
void centerview(ARegion *ar, View3D *v3d);
void centerview(struct ARegion *ar, View3D *v3d);
void smooth_view(struct bContext *C, Object *, Object *, float *ofs, float *quat, float *dist, float *lens);

@ -79,6 +79,8 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_lasso_select);
WM_operatortype_append(VIEW3D_OT_setcameratoview);
WM_operatortype_append(VIEW3D_OT_drawtype);
WM_operatortype_append(VIEW3D_OT_vpaint_toggle);
WM_operatortype_append(VIEW3D_OT_vpaint);
transform_operatortypes();
}
@ -88,6 +90,9 @@ void view3d_keymap(wmWindowManager *wm)
ListBase *keymap= WM_keymap_listbase(wm, "View3D", SPACE_VIEW3D, 0);
wmKeymapItem *km;
/* paint poll checks mode */
WM_keymap_verify_item(keymap, "VIEW3D_OT_vpaint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "VIEW3D_OT_cursor3d", ACTIONMOUSE, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "VIEW3D_OT_viewrotate", MIDDLEMOUSE, KM_PRESS, 0, 0);
@ -148,6 +153,8 @@ void view3d_keymap(wmWindowManager *wm)
WM_keymap_add_item(keymap, "VIEW3D_OT_render_border", BKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_set_camera_to_view", PAD0, KM_PRESS, KM_ALT|KM_CTRL, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_vpaint_toggle", VKEY, KM_PRESS, 0, 0);
/* TODO - this is just while we have no way to load a text datablock */
RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_run_pyfile", PKEY, KM_PRESS, 0, 0)->ptr, "filename", "test.py");

@ -89,7 +89,7 @@
#include "view3d_intern.h" // own include
static void view3d_set_viewcontext(bContext *C, ViewContext *vc)
void view3d_set_viewcontext(bContext *C, ViewContext *vc)
{
memset(vc, 0, sizeof(ViewContext));
vc->ar= CTX_wm_region(C);

@ -993,28 +993,6 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d)
}
}
void setcameratoview3d(View3D *v3d)
{
Object *ob;
float dvec[3];
ob= v3d->camera;
dvec[0]= v3d->dist*v3d->viewinv[2][0];
dvec[1]= v3d->dist*v3d->viewinv[2][1];
dvec[2]= v3d->dist*v3d->viewinv[2][2];
VECCOPY(ob->loc, dvec);
VecSubf(ob->loc, ob->loc, v3d->ofs);
v3d->viewquat[0]= -v3d->viewquat[0];
/* */
/*if (ob->transflag & OB_QUAT) {
QUATCOPY(ob->quat, v3d->viewquat);
} else {*/
QuatToEul(v3d->viewquat, ob->rot);
/*}*/
v3d->viewquat[0]= -v3d->viewquat[0];
}
/* IGLuint-> GLuint*/
/* Warning: be sure to account for a negative return value
* This is an error, "Too many objects in select buffer"

File diff suppressed because it is too large Load Diff

@ -101,6 +101,7 @@
#include "ED_util.h"
#include "UI_view2d.h"
#include "WM_types.h"
#include "WM_api.h"
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
@ -329,13 +330,12 @@ void convertDisplayNumToVec(float *num, float *vec)
#endif
}
static void viewRedrawForce(TransInfo *t)
static void viewRedrawForce(bContext *C, TransInfo *t)
{
if (t->spacetype == SPACE_VIEW3D)
{
// TRANSFORM_FIX_ME
// need to redraw ALL 3d view
ED_area_tag_redraw(t->sa);
/* Do we need more refined tags? */
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
}
else if (t->spacetype == SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
@ -347,8 +347,10 @@ static void viewRedrawForce(TransInfo *t)
else
ED_area_tag_redraw(t->sa);
}
else if(t->spacetype == SPACE_NODE) {
ED_area_tag_redraw(t->sa);
else if(t->spacetype == SPACE_NODE)
{
//ED_area_tag_redraw(t->sa);
WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
}
#if 0 // TRANSFORM_FIX_ME
else if (t->spacetype==SPACE_IMAGE) {
@ -1101,7 +1103,7 @@ void initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
void transformApply(TransInfo *t)
void transformApply(bContext *C, TransInfo *t)
{
if (t->redraw)
{
@ -1111,6 +1113,7 @@ void transformApply(TransInfo *t)
selectConstraint(t);
if (t->transform) {
t->transform(t, t->mval); // calls recalcData()
viewRedrawForce(C, t);
}
t->redraw = 0;
}
@ -1140,6 +1143,7 @@ int transformEnd(bContext *C, TransInfo *t)
{
exit_code = OPERATOR_CANCELLED;
restoreTransObjects(t); // calls recalcData()
viewRedrawForce(C, t);
}
else
{
@ -1850,8 +1854,6 @@ int Warp(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
helpline(t, gcursor);
return 1;
@ -1974,8 +1976,6 @@ int Shear(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
helpline (t, t->center);
return 1;
@ -2247,8 +2247,6 @@ int Resize(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
return 1;
@ -2340,8 +2338,6 @@ int ToSphere(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
return 1;
}
@ -2656,8 +2652,6 @@ int Rotation(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
return 1;
@ -2765,8 +2759,6 @@ int Trackball(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
return 1;
@ -2959,8 +2951,6 @@ int Translation(TransInfo *t, short mval[2])
recalcData(t);
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
drawSnapping(t);
@ -3039,8 +3029,6 @@ int ShrinkFatten(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
return 1;
}
@ -3113,8 +3101,6 @@ int Tilt(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
helpline (t, t->center);
return 1;
@ -3181,8 +3167,6 @@ int CurveShrinkFatten(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
return 1;
@ -3272,8 +3256,6 @@ int PushPull(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
return 1;
}
@ -3387,8 +3369,6 @@ int Bevel(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
return 1;
}
@ -3460,8 +3440,6 @@ int BevelWeight(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
helpline (t, t->center);
return 1;
@ -3538,8 +3516,6 @@ int Crease(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
helpline (t, t->center);
return 1;
@ -3657,8 +3633,6 @@ int BoneSize(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
return 1;
@ -3727,8 +3701,6 @@ int BoneEnvelope(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
return 1;
@ -3795,8 +3767,6 @@ int BoneRoll(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
return 1;
@ -3875,8 +3845,6 @@ int BakeTime(TransInfo *t, short mval[2])
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
helpline (t, t->center);
return 1;
@ -3933,8 +3901,6 @@ int Mirror(TransInfo *t, short mval[2])
recalcData(t);
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
}
else
{
@ -3955,8 +3921,6 @@ int Mirror(TransInfo *t, short mval[2])
recalcData(t);
ED_area_headerprint(t->sa, "Select a mirror axis (X, Y, Z)");
viewRedrawForce(t);
}
return 1;
@ -4275,8 +4239,6 @@ int TimeTranslate(TransInfo *t, short mval[2])
recalcData(t);
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
return 1;
}
@ -4403,8 +4365,6 @@ int TimeSlide(TransInfo *t, short mval[2])
recalcData(t);
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
return 1;
}
@ -4519,8 +4479,6 @@ int TimeScale(TransInfo *t, short mval[2])
recalcData(t);
ED_area_headerprint(t->sa, str);
viewRedrawForce(t);
return 1;
}

@ -344,7 +344,7 @@ void TFM_OT_transform(struct wmOperatorType *ot);
void initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, struct wmEvent *event);
void saveTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op);
void transformEvent(TransInfo *t, struct wmEvent *event);
void transformApply(TransInfo *t);
void transformApply(struct bContext *C, TransInfo *t);
int transformEnd(struct bContext *C, TransInfo *t);
void setTransformViewMatrices(TransInfo *t);

@ -1021,25 +1021,29 @@ static void createTransPose(bContext *C, TransInfo *t, Object *ob)
static void createTransArmatureVerts(bContext *C, TransInfo *t)
{
// TRANSFORM_FIX_ME
#if 0
EditBone *ebo;
bArmature *arm= t->obedit->data;
ListBase *edbo = arm->edbo;
TransData *td;
float mtx[3][3], smtx[3][3], delta[3], bonemat[3][3];
t->total = 0;
for (ebo=G.edbo.first;ebo;ebo=ebo->next) {
if(ebo->layer & arm->layer) {
if (t->mode==TFM_BONESIZE) {
for (ebo = edbo->first; ebo; ebo = ebo->next)
{
if(ebo->layer & arm->layer)
{
if (t->mode==TFM_BONESIZE)
{
if (ebo->flag & BONE_SELECTED)
t->total++;
}
else if (t->mode==TFM_BONE_ROLL) {
else if (t->mode==TFM_BONE_ROLL)
{
if (ebo->flag & BONE_SELECTED)
t->total++;
}
else {
else
{
if (ebo->flag & BONE_TIPSEL)
t->total++;
if (ebo->flag & BONE_ROOTSEL)
@ -1055,13 +1059,15 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransEditBone");
for (ebo=G.edbo.first;ebo;ebo=ebo->next){
ebo->oldlength= ebo->length; // length==0.0 on extrude, used for scaling radius of bone points
for (ebo = edbo->first; ebo; ebo = ebo->next)
{
ebo->oldlength = ebo->length; // length==0.0 on extrude, used for scaling radius of bone points
if(ebo->layer & arm->layer) {
if (t->mode==TFM_BONE_ENVELOPE) {
if (ebo->flag & BONE_ROOTSEL){
if (t->mode==TFM_BONE_ENVELOPE)
{
if (ebo->flag & BONE_ROOTSEL)
{
td->val= &ebo->rad_head;
td->ival= *td->val;
@ -1077,7 +1083,8 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
td++;
}
if (ebo->flag & BONE_TIPSEL){
if (ebo->flag & BONE_TIPSEL)
{
td->val= &ebo->rad_tail;
td->ival= *td->val;
VECCOPY (td->center, ebo->tail);
@ -1094,14 +1101,17 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
}
}
else if (t->mode==TFM_BONESIZE) {
else if (t->mode==TFM_BONESIZE)
{
if (ebo->flag & BONE_SELECTED) {
if(arm->drawtype==ARM_ENVELOPE) {
if(arm->drawtype==ARM_ENVELOPE)
{
td->loc= NULL;
td->val= &ebo->dist;
td->ival= ebo->dist;
}
else {
else
{
// abusive storage of scale in the loc pointer :)
td->loc= &ebo->xwidth;
VECCOPY (td->iloc, td->loc);
@ -1125,8 +1135,10 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
td++;
}
}
else if (t->mode==TFM_BONE_ROLL) {
if (ebo->flag & BONE_SELECTED) {
else if (t->mode==TFM_BONE_ROLL)
{
if (ebo->flag & BONE_SELECTED)
{
td->loc= NULL;
td->val= &(ebo->roll);
td->ival= ebo->roll;
@ -1140,8 +1152,10 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
td++;
}
}
else {
if (ebo->flag & BONE_TIPSEL){
else
{
if (ebo->flag & BONE_TIPSEL)
{
VECCOPY (td->iloc, ebo->tail);
VECCOPY (td->center, td->iloc);
td->loc= ebo->tail;
@ -1166,7 +1180,8 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
td++;
}
if (ebo->flag & BONE_ROOTSEL){
if (ebo->flag & BONE_ROOTSEL)
{
VECCOPY (td->iloc, ebo->head);
VECCOPY (td->center, td->iloc);
td->loc= ebo->head;
@ -1191,7 +1206,6 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
}
}
}
#endif
}
/* ********************* meta elements ********* */

@ -421,30 +421,7 @@ void recalcData(TransInfo *t)
}
}
else if (t->obedit) {
if (t->obedit->type == OB_MESH) {
if(t->spacetype==SPACE_IMAGE) {
flushTransUVs(t);
if (G.sima->flag & SI_LIVE_UNWRAP)
unwrap_lscm_live_re_solve();
} else {
EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh
/* mirror modifier clipping? */
if(t->state != TRANS_CANCEL) {
if ((G.qual & LR_CTRLKEY)==0) {
/* Only retopo if not snapping, Note, this is the only case of G.qual being used, but we have no T_SHIFT_MOD - Campbell */
retopo_do_all();
}
clipMirrorModifier(t, t->obedit);
}
if((t->options & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
editmesh_apply_to_mirror(t);
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
recalc_editnormals(em);
}
}
else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
Nurb *nu= editNurb.first;
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
@ -463,14 +440,68 @@ void recalcData(TransInfo *t)
retopo_do_all();
}
}
else if(t->obedit->type==OB_ARMATURE){ /* no recalc flag, does pose */
else if(t->obedit->type==OB_LATTICE) {
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
if(editLatt->flag & LT_OUTSIDE) outside_lattice(editLatt);
}
else {
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
}
}
else if( (t->flag & T_POSE) && t->poseobj) {
Object *ob= t->poseobj;
bArmature *arm= ob->data;
/* old optimize trick... this enforces to bypass the depgraph */
if (!(arm->flag & ARM_DELAYDEFORM)) {
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); /* sets recalc flags */
}
else
where_is_pose(ob);
}
else if(G.f & G_PARTICLEEDIT) {
flushTransParticles(t);
}
#endif
if (t->spacetype==SPACE_NODE) {
flushTransNodes(t);
}
else if (t->obedit) {
if (t->obedit->type == OB_MESH) {
if(t->spacetype==SPACE_IMAGE) {
flushTransUVs(t);
/* TRANSFORM_FIX_ME */
// if (G.sima->flag & SI_LIVE_UNWRAP)
// unwrap_lscm_live_re_solve();
} else {
EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
/* mirror modifier clipping? */
if(t->state != TRANS_CANCEL) {
/* TRANSFORM_FIX_ME */
// if ((G.qual & LR_CTRLKEY)==0) {
// /* Only retopo if not snapping, Note, this is the only case of G.qual being used, but we have no T_SHIFT_MOD - Campbell */
// retopo_do_all();
// }
clipMirrorModifier(t, t->obedit);
}
if((t->options & CTX_NO_MIRROR) == 0 && (t->scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
editmesh_apply_to_mirror(t);
DAG_object_flush_update(t->scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
recalc_editnormals(em);
}
}
else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
bArmature *arm= t->obedit->data;
ListBase *edbo = arm->edbo;
EditBone *ebo;
TransData *td = t->data;
int i;
/* Ensure all bones are correctly adjusted */
for (ebo=G.edbo.first; ebo; ebo=ebo->next){
for (ebo = edbo->first; ebo; ebo = ebo->next){
if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
/* If this bone has a parent tip that has been moved */
@ -531,68 +562,15 @@ void recalcData(TransInfo *t)
Mat3MulVecfl(t->mat, up_axis);
}
ebo->roll = rollBoneToVector(ebo, up_axis);
ebo->roll = ED_rollBoneToVector(ebo, up_axis);
}
}
}
if(arm->flag & ARM_MIRROR_EDIT)
transform_armature_mirror_update();
transform_armature_mirror_update(t->obedit);
}
else if(t->obedit->type==OB_LATTICE) {
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
if(editLatt->flag & LT_OUTSIDE) outside_lattice(editLatt);
}
else {
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
}
}
else if( (t->flag & T_POSE) && t->poseobj) {
Object *ob= t->poseobj;
bArmature *arm= ob->data;
/* old optimize trick... this enforces to bypass the depgraph */
if (!(arm->flag & ARM_DELAYDEFORM)) {
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); /* sets recalc flags */
}
else
where_is_pose(ob);
}
else if(G.f & G_PARTICLEEDIT) {
flushTransParticles(t);
}
#endif
if (t->spacetype==SPACE_NODE) {
flushTransNodes(t);
}
else if (t->obedit) {
if (t->obedit->type == OB_MESH) {
if(t->spacetype==SPACE_IMAGE) {
flushTransUVs(t);
/* TRANSFORM_FIX_ME */
// if (G.sima->flag & SI_LIVE_UNWRAP)
// unwrap_lscm_live_re_solve();
} else {
EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
/* mirror modifier clipping? */
if(t->state != TRANS_CANCEL) {
/* TRANSFORM_FIX_ME */
// if ((G.qual & LR_CTRLKEY)==0) {
// /* Only retopo if not snapping, Note, this is the only case of G.qual being used, but we have no T_SHIFT_MOD - Campbell */
// retopo_do_all();
// }
clipMirrorModifier(t, t->obedit);
}
if((t->options & CTX_NO_MIRROR) == 0 && (t->scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
editmesh_apply_to_mirror(t);
DAG_object_flush_update(t->scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
recalc_editnormals(em);
}
}
}
else {
for(base= FIRSTBASE; base; base= base->next) {
@ -1026,10 +1004,10 @@ void calculateCenter(TransInfo *t)
case V3D_ACTIVE:
{
/* set median, and if if if... do object center */
#if 0 // TRANSFORM_FIX_ME
EditSelection ese;
/* EDIT MODE ACTIVE EDITMODE ELEMENT */
#if 0 // TRANSFORM_FIX_ME
if (t->obedit && t->obedit->type == OB_MESH && EM_get_actSelection(&ese)) {
EM_editselection_center(t->center, &ese);
calculateCenter2D(t);

@ -70,7 +70,7 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
transformEvent(t, event);
transformApply(t);
transformApply(C, t);
exit_code = transformEnd(C, t);
@ -104,7 +104,7 @@ static int transform_exec(bContext *C, wmOperator *op)
t->options |= CTX_AUTOCONFIRM;
transformApply(t);
transformApply(C, t);
transformEnd(C, t);

@ -53,6 +53,10 @@ typedef struct Lattice {
struct MDeformVert *dvert;
/* used while deforming, always free and NULL after use */
float *latticedata;
float latmat[4][4];
struct Lattice *editlatt;
} Lattice;

@ -331,5 +331,11 @@ extern UserDef U; /* from blenkernel blender.c */
#define GP_PAINT_DOSMOOTH (1<<0)
#define GP_PAINT_DOSIMPLIFY (1<<1)
/* theme drawtypes */
#define TH_MINIMAL 0
#define TH_ROUNDSHADED 1
#define TH_ROUNDED 2
#define TH_OLDSKOOL 3
#define TH_SHADED 4
#endif

@ -68,6 +68,8 @@ typedef struct wmWindowManager {
ListBase reports; /* information and error reports */
ListBase paintcursors; /* extra overlay cursors to draw, like circles */
/* used keymaps, optionally/partially saved */
ListBase keymaps;

@ -36,6 +36,8 @@ struct Main;
extern BlenderRNA BLENDER_RNA;
extern StructRNA RNA_Action;
extern StructRNA RNA_ActionChannel;
extern StructRNA RNA_ActionGroup;
extern StructRNA RNA_Actuator;
extern StructRNA RNA_ActuatorSensor;
extern StructRNA RNA_AlwaysSensor;
@ -55,8 +57,8 @@ extern StructRNA RNA_BuildModifier;
extern StructRNA RNA_Camera;
extern StructRNA RNA_CastModifier;
extern StructRNA RNA_CharInfo;
extern StructRNA RNA_ClothModifier;
extern StructRNA RNA_ClothCollisionSettings;
extern StructRNA RNA_ClothModifier;
extern StructRNA RNA_ClothSettings;
extern StructRNA RNA_CollectionProperty;
extern StructRNA RNA_CollisionModifier;
@ -118,7 +120,6 @@ extern StructRNA RNA_Lattice;
extern StructRNA RNA_LatticeModifier;
extern StructRNA RNA_LatticePoint;
extern StructRNA RNA_Library;
extern StructRNA RNA_MappingTexture;
extern StructRNA RNA_MCol;
extern StructRNA RNA_MColLayer;
extern StructRNA RNA_MFloatProperty;
@ -223,11 +224,30 @@ extern StructRNA RNA_TextBox;
extern StructRNA RNA_TextLine;
extern StructRNA RNA_TextMarker;
extern StructRNA RNA_Texture;
extern StructRNA RNA_TextureSlot;
extern StructRNA RNA_Theme;
extern StructRNA RNA_ThemeActionEditor;
extern StructRNA RNA_ThemeAudioWindow;
extern StructRNA RNA_ThemeBoneColorSet;
extern StructRNA RNA_ThemeButtonsWindow;
extern StructRNA RNA_ThemeFileBrowser;
extern StructRNA RNA_ThemeImageEditor;
extern StructRNA RNA_ThemeIpoEditor;
extern StructRNA RNA_ThemeNLAEditor;
extern StructRNA RNA_ThemeNodeEditor;
extern StructRNA RNA_ThemeOutliner;
extern StructRNA RNA_ThemeSequenceEditor;
extern StructRNA RNA_ThemeTextEditor;
extern StructRNA RNA_ThemeTimeline;
extern StructRNA RNA_ThemeUserInterface;
extern StructRNA RNA_ThemeUserPreferences;
extern StructRNA RNA_ThemeView3D;
extern StructRNA RNA_TouchSensor;
extern StructRNA RNA_TransformSequence;
extern StructRNA RNA_UVProjectModifier;
extern StructRNA RNA_UnknownType;
extern StructRNA RNA_UserPreferences;
extern StructRNA RNA_UserSolidLight;
extern StructRNA RNA_VectorFont;
extern StructRNA RNA_VertexGroup;
extern StructRNA RNA_WaveModifier;
@ -250,8 +270,8 @@ extern StructRNA RNA_XorController;
*/
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr);
void RNA_id_pointer_create(StructRNA *idtype, struct ID *id, PointerRNA *r_ptr);
void RNA_pointer_create(StructRNA *idtype, struct ID *id, StructRNA *type, void *data, PointerRNA *r_ptr);
void RNA_id_pointer_create(struct ID *id, PointerRNA *r_ptr);
void RNA_pointer_create(struct ID *id, StructRNA *type, void *data, PointerRNA *r_ptr);
void RNA_blender_rna_pointer_create(PointerRNA *r_ptr);

@ -43,6 +43,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
void RNA_def_struct_sdna(StructRNA *srna, const char *structname);
void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname);
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop);
void RNA_def_struct_parent(StructRNA *srna, StructRNA *parent);
void RNA_def_struct_flag(StructRNA *srna, int flag);
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine);
void RNA_def_struct_identifier(StructRNA *srna, const char *identifier);

@ -132,7 +132,8 @@ typedef enum StructFlag {
STRUCT_ID = 1,
/* internal flags */
STRUCT_RUNTIME = 2
STRUCT_RUNTIME = 2,
STRUCT_GENERATED = 4
} StructFlag;
typedef struct StructRNA StructRNA;

@ -24,8 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
SET(SRC
makesrna.c
SET(DEFSRC
rna_action.c
rna_actuator.c
rna_armature.c
@ -36,7 +35,6 @@ SET(SRC
rna_constraint.c
rna_controller.c
rna_curve.c
rna_define.c
rna_fluidsim.c
rna_group.c
rna_ID.c
@ -70,7 +68,58 @@ SET(SRC
rna_userdef.c
rna_vfont.c
rna_wm.c
rna_world.c
rna_world.c)
SET(GENSRC
rna_action_gen.c
rna_actuator_gen.c
rna_armature_gen.c
rna_brush_gen.c
rna_camera_gen.c
rna_cloth_gen.c
rna_color_gen.c
rna_constraint_gen.c
rna_controller_gen.c
rna_curve_gen.c
rna_fluidsim_gen.c
rna_group_gen.c
rna_ID_gen.c
rna_image_gen.c
rna_ipo_gen.c
rna_key_gen.c
rna_lamp_gen.c
rna_lattice_gen.c
rna_main_gen.c
rna_material_gen.c
rna_mesh_gen.c
rna_meta_gen.c
rna_modifier_gen.c
rna_nodetree_gen.c
rna_object_gen.c
rna_object_force_gen.c
rna_packedfile_gen.c
rna_particle_gen.c
rna_pose_gen.c
rna_property_gen.c
rna_radio_gen.c
rna_rna_gen.c
rna_scene_gen.c
rna_screen_gen.c
rna_scriptlink_gen.c
rna_sensor_gen.c
rna_sequence_gen.c
rna_sound_gen.c
rna_text_gen.c
rna_texture_gen.c
rna_userdef_gen.c
rna_vfont_gen.c
rna_wm_gen.c
rna_world_gen.c)
SET(SRC
makesrna.c
rna_define.c
${DEFSRC}
../../../../intern/guardedalloc/intern/mallocn.c
../../../../intern/guardedalloc/intern/mmap_win.c)
@ -81,15 +130,16 @@ FILE(GLOB INC_FILES ../*.h ../../makesdna/*.h)
ADD_EXECUTABLE(makesrna ${SRC} ${INC_FILES})
TARGET_LINK_LIBRARIES(makesrna bf_dna)
# Output rna.c
# Output rna_*_gen.c
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/rna.c
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesrna ${CMAKE_CURRENT_BINARY_DIR}/rna.c ${CMAKE_SOURCE_DIR}/source/blender/makesrna/
OUTPUT ${GENSRC}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesrna ${CMAKE_CURRENT_BINARY_DIR}/ ${CMAKE_SOURCE_DIR}/source/blender/makesrna/
DEPENDS makesrna
)
# Build bf_rna
SET(SRC rna_access.c rna_dependency.c rna.c)
SET(SRC rna_access.c rna_dependency.c ${GENSRC})
BLENDERLIB(bf_rna "${SRC}" "${INC}")
MESSAGE(STATUS "Configuring makesrna")

@ -24,7 +24,17 @@
LIBNAME = rna
DIR = $(OCGDIR)/blender/makesrna
CSRCS = RNA.c $(wildcard rna_*.c)
ALLRNA = $(wildcard rna_*.c)
DEFRNA = $(filter-out %rna_define.c, $(filter-out %rna_dependency.c, $(filter-out %rna_access.c, $(ALLRNA))))
GENSRCS = $(patsubst rna_%.c, rna_%_gen.c, $(DEFRNA))
GENTARGET = $(patsubst %.c, $(DIR)/$(DEBUG_DIR)%.c, $(GENSRCS))
MAKESRCS = $(DEFRNA) makesrna.c rna_define.c
MAKEOBJS = $(patsubst %.c, $(DIR)/$(DEBUG_DIR)%.o, $(MAKESRCS))
CSRCS = $(GENSRCS) rna_access.c rna_dependency.c
include nan_compile.mk
@ -53,8 +63,8 @@ ifeq ($(OS),windows)
endif
clean::
@$(RM) $(DIR)/makesrna* $(DIR)/RNA.c
@$(RM) $(DIR)/debug/makesrna* $(DIR)/debug/RNA.c
@$(RM) $(DIR)/makesrna* $(DIR)/rna*
@$(RM) $(DIR)/debug/makesrna* $(DIR)/debug/rna*
# TODO include right .mk for ldflags
@ -62,18 +72,19 @@ clean::
# is done quite intentionally. If there is a bug in that lib, it needs
# to be fixed by the module maintainer.
RNAOBJS = $(filter-out %rna_dependency.o, $(filter-out %rna_access.o, $(filter-out %RNA.o, $(OBJS))))
$(DIR)/$(DEBUG_DIR)makesrna: $(RNAOBJS) $(DIR)/$(DEBUG_DIR)makesrna.o $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)libdna.a $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a
$(DIR)/$(DEBUG_DIR)makesrna: $(MAKEOBJS) $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)libdna.a $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a
$(CC) $(LDFLAGS) -o $@ $(WINLIBS) $^
$(DIR)/$(DEBUG_DIR)RNA.c: $(DIR)/$(DEBUG_DIR)makesrna
$(DIR)/$(DEBUG_DIR)rna_phony_gen.c: $(DIR)/$(DEBUG_DIR)makesrna
ifeq ($(OS),windows)
$(SRCHOME)/tools/cygwin/cl_wrapper.pl - $(DIR)/$(DEBUG_DIR)makesrna \
$(DIR)/$(DEBUG_DIR)RNA.c
$(DIR)/$(DEBUG_DIR)
else
$(DIR)/$(DEBUG_DIR)makesrna $(DIR)/$(DEBUG_DIR)RNA.c
$(DIR)/$(DEBUG_DIR)makesrna $(DIR)/$(DEBUG_DIR)
endif
@touch $@
$(GENTARGET): $(DIR)/$(DEBUG_DIR)rna_phony_gen.c
$(DIR)/$(DEBUG_DIR)makesrna.o: makesrna.c $(wildcard rna_*.c)
$(CC) -c $(CFLAGS) $(CPPFLAGS) makesrna.c -o $@

@ -14,6 +14,12 @@ source_files = env.Glob('*.c')
source_files.remove('rna_access.c')
source_files.remove('rna_dependency.c')
generated_files = source_files[:]
generated_files.remove('rna_define.c')
generated_files.remove('makesrna.c')
generated_files = [filename[:-2] + '_gen.c' for filename in generated_files]
makesrna_tool = env.Clone()
rna = env.Clone()
makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ')
@ -59,11 +65,19 @@ else:
makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
rna_dict = rna.Dictionary()
rna.Depends ('rna.c', makesrna)
rna.Depends (generated_files, makesrna)
# this seems bad, how to retrieve it from scons?
build_dir = root_build_dir + '/source/blender/makesrna/intern/'
if env['OURPLATFORM'] != 'linuxcross':
rna.Command ('rna.c', '', root_build_dir+os.sep+"makesrna $TARGET")
rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna " + build_dir)
else:
rna.Command ('rna.c', '', root_build_dir+os.sep+"makesrna.exe $TARGET")
obj = ['intern/rna.c', 'intern/rna_access.c', 'intern/rna_dependency.c']
rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
obj = ['intern/rna_access.c', 'intern/rna_dependency.c']
for generated_file in generated_files:
obj += ['intern/' + generated_file]
Return ('obj')

@ -167,6 +167,15 @@ static int rna_enum_bitmask(PropertyRNA *prop)
return mask;
}
static int rna_color_quantize(PropertyRNA *prop, PropertyDefRNA *dp)
{
if(prop->type == PROP_FLOAT && prop->subtype == PROP_COLOR)
if(strcmp(dp->dnatype, "float") != 0 && strcmp(dp->dnatype, "double") != 0)
return 1;
return 0;
}
static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp)
{
char *func;
@ -212,6 +221,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
else {
if(prop->type == PROP_BOOLEAN && dp->booleanbit)
fprintf(f, " return (%s(data->%s[index] & %d) != 0);\n", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
else if(rna_color_quantize(prop, dp))
fprintf(f, " return (%s)(data->%s[index]/255.0f);\n", rna_type_type(prop), dp->dnaname);
else
fprintf(f, " return (%s)%s(data->%s[index]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
}
@ -326,6 +337,9 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, " if(%svalue) data->%s[index] |= %d;\n", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
fprintf(f, " else data->%s[index] &= ~%d;\n", dp->dnaname, dp->booleanbit);
}
else if(rna_color_quantize(prop, dp)) {
fprintf(f, " data->%s[index]= FTOCHAR(value);\n", dp->dnaname);
}
else {
rna_clamp_value(f, prop);
fprintf(f, " data->%s[index]= %svalue;\n", dp->dnaname, (dp->booleannegative)? "!": "");
@ -584,18 +598,6 @@ static void rna_auto_types()
}
}
static void rna_auto_functions(FILE *f)
{
StructDefRNA *ds;
PropertyDefRNA *dp;
fprintf(f, "/* Autogenerated Functions */\n\n");
for(ds=DefRNA.structs.first; ds; ds=ds->next)
for(dp=ds->properties.first; dp; dp=dp->next)
rna_def_property_funcs(f, dp);
}
static void rna_sort(BlenderRNA *brna)
{
StructRNA *srna;
@ -654,8 +656,13 @@ static void rna_generate_prototypes(BlenderRNA *brna, FILE *f)
StructRNA *srna;
for(srna=brna->structs.first; srna; srna=srna->next)
fprintf(f, "StructRNA RNA_%s;\n", srna->identifier);
fprintf(f, "extern StructRNA RNA_%s;\n", srna->identifier);
fprintf(f, "\n");
}
static void rna_generate_blender(BlenderRNA *brna, FILE *f)
{
StructRNA *srna;
fprintf(f, "BlenderRNA BLENDER_RNA = {");
@ -876,6 +883,9 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
if(srna->from) fprintf(f, "\t&RNA_%s,\n", (char*)srna->from);
else fprintf(f, "\tNULL,\n");
if(srna->parent) fprintf(f, "\t&RNA_%s,\n", (char*)srna->parent);
else fprintf(f, "\tNULL,\n");
fprintf(f, "\t%s,\n", rna_function_string(srna->refine));
prop= srna->properties.first;
@ -943,18 +953,15 @@ RNAProcessItem PROCESS_ITEMS[]= {
{"rna_world.c", RNA_def_world},
{NULL, NULL}};
static int rna_preprocess(char *basedirectory, FILE *f)
static void rna_generate(BlenderRNA *brna, char *basedirectory, FILE *f, char *filename)
{
BlenderRNA *brna;
StructRNA *srna;
int i, status;
StructDefRNA *ds;
PropertyDefRNA *dp;
fprintf(f, "\n/* Automatically generated struct definitions for the Data API.\n"
" Do not edit manually, changes will be overwritten */\n\n"
"#define RNA_RUNTIME\n\n");
brna= RNA_create();
fprintf(f, "#include <float.h>\n");
fprintf(f, "#include <limits.h>\n");
fprintf(f, "#include <string.h>\n\n");
@ -967,82 +974,119 @@ static int rna_preprocess(char *basedirectory, FILE *f)
fprintf(f, "#include \"RNA_types.h\"\n");
fprintf(f, "#include \"rna_internal.h\"\n\n");
/* this is ugly, but we cannot have c files compiled for both
* makesrna and blender with some build systems at the moment */
fprintf(f, "#include \"rna_define.c\"\n\n");
for(i=0; PROCESS_ITEMS[i].filename; i++)
if(PROCESS_ITEMS[i].define)
PROCESS_ITEMS[i].define(brna);
rna_sort(brna);
rna_auto_types();
rna_generate_prototypes(brna, f);
for(i=0; PROCESS_ITEMS[i].filename; i++)
fprintf(f, "#include \"%s\"\n", PROCESS_ITEMS[i].filename);
fprintf(f, "\n");
fprintf(f, "#include \"%s\"\n\n", filename);
rna_auto_functions(f);
fprintf(f, "/* Autogenerated Functions */\n\n");
for(srna=brna->structs.first; srna; srna=srna->next)
rna_generate_struct(brna, srna, f);
status= DefRNA.error;
for(ds=DefRNA.structs.first; ds; ds=ds->next)
if(!filename || ds->filename == filename)
for(dp=ds->properties.first; dp; dp=dp->next)
rna_def_property_funcs(f, dp);
RNA_define_free(brna);
RNA_free(brna);
for(ds=DefRNA.structs.first; ds; ds=ds->next)
if(!filename || ds->filename == filename)
rna_generate_struct(brna, ds->srna, f);
return status;
if(strcmp(filename, "rna_ID.c") == 0) {
/* this is ugly, but we cannot have c files compiled for both
* makesrna and blender with some build systems at the moment */
fprintf(f, "#include \"rna_define.c\"\n\n");
rna_generate_blender(brna, f);
}
}
static void make_bad_file(char *file)
{
FILE *fp= fopen(file, "w");
fprintf(fp, "ERROR! Cannot make correct RNA.c file, STUPID!\n");
fprintf(fp, "ERROR! Cannot make correct RNA file, STUPID!\n");
fclose(fp);
}
static int rna_preprocess(char *basedirectory, char *outfile)
{
BlenderRNA *brna;
StructDefRNA *ds;
FILE *file;
char deffile[4096];
int i, status, len;
/* define rna */
brna= RNA_create();
for(i=0; PROCESS_ITEMS[i].filename; i++) {
if(PROCESS_ITEMS[i].define) {
PROCESS_ITEMS[i].define(brna);
for(ds=DefRNA.structs.first; ds; ds=ds->next)
if(!ds->filename)
ds->filename= PROCESS_ITEMS[i].filename;
}
}
rna_sort(brna);
rna_auto_types();
status= (DefRNA.error != 0);
len= strlen(outfile);
for(i=0; PROCESS_ITEMS[i].filename; i++) {
strcpy(deffile, outfile);
strcat(deffile, PROCESS_ITEMS[i].filename);
deffile[strlen(deffile)-2] = '\0';
strcat(deffile, "_gen.c");
if(status) {
make_bad_file(deffile);
}
else {
file = fopen(deffile, "w");
if(!file) {
printf ("Unable to open file: %s\n", deffile);
status = 1;
}
else {
rna_generate(brna, basedirectory, file, PROCESS_ITEMS[i].filename);
fclose(file);
status= (DefRNA.error != 0);
}
}
}
RNA_define_free(brna);
RNA_free(brna);
return status;
}
#ifndef BASE_HEADER
#define BASE_HEADER "../"
#endif
int main(int argc, char **argv)
{
FILE *file;
int totblock, return_status = 0;
if (argc!=2 && argc!=3) {
printf("Usage: %s outfile.c [base directory]\n", argv[0]);
printf("Usage: %s outdirectory/ [base directory]\n", argv[0]);
return_status = 1;
}
else {
file = fopen(argv[1], "w");
char baseDirectory[256];
if (!file) {
printf ("Unable to open file: %s\n", argv[1]);
return_status = 1;
}
else {
char baseDirectory[256];
printf("Running makesrna, program versions %s\n", RNA_VERSION_DATE);
printf("Running makesrna, program versions %s\n", RNA_VERSION_DATE);
if (argc==3)
strcpy(baseDirectory, argv[2]);
else
strcpy(baseDirectory, BASE_HEADER);
if (argc==3)
strcpy(baseDirectory, argv[2]);
else
strcpy(baseDirectory, BASE_HEADER);
return_status= (rna_preprocess(baseDirectory, file));
fclose(file);
if(return_status) {
/* error */
make_bad_file(argv[1]);
return_status = 1;
}
}
return_status= rna_preprocess(baseDirectory, argv[1]);
}
totblock= MEM_get_memory_blocks_in_use();

@ -35,25 +35,25 @@
#include "BKE_idprop.h"
/* name functions that ignore the first two ID characters */
static void rna_ID_name_get(PointerRNA *ptr, char *value)
void rna_ID_name_get(PointerRNA *ptr, char *value)
{
ID *id= (ID*)ptr->data;
BLI_strncpy(value, id->name+2, sizeof(id->name)-2);
}
static int rna_ID_name_length(PointerRNA *ptr)
int rna_ID_name_length(PointerRNA *ptr)
{
ID *id= (ID*)ptr->data;
return strlen(id->name+2);
}
static void rna_ID_name_set(PointerRNA *ptr, const char *value)
void rna_ID_name_set(PointerRNA *ptr, const char *value)
{
ID *id= (ID*)ptr->data;
BLI_strncpy(id->name+2, value, sizeof(id->name)-2);
}
static StructRNA *rna_ID_refine(PointerRNA *ptr)
StructRNA *rna_ID_refine(PointerRNA *ptr)
{
ID *id= (ID*)ptr->data;
@ -87,7 +87,7 @@ static StructRNA *rna_ID_refine(PointerRNA *ptr)
}
}
static void rna_ID_fake_user_set(PointerRNA *ptr, int value)
void rna_ID_fake_user_set(PointerRNA *ptr, int value)
{
ID *id= (ID*)ptr->data;

@ -61,16 +61,34 @@ void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
r_ptr->data= main;
}
void RNA_id_pointer_create(StructRNA *idtype, ID *id, PointerRNA *r_ptr)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
{
PointerRNA tmp;
StructRNA *idtype= NULL;
if(id) {
memset(&tmp, 0, sizeof(tmp));
tmp.data= id;
idtype= rna_ID_refine(&tmp);
}
r_ptr->id.type= idtype;
r_ptr->id.data= id;
r_ptr->type= idtype;
r_ptr->data= id;
}
void RNA_pointer_create(StructRNA *idtype, ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
{
PointerRNA tmp;
StructRNA *idtype= NULL;
if(id) {
memset(&tmp, 0, sizeof(tmp));
tmp.data= id;
idtype= rna_ID_refine(&tmp);
}
r_ptr->id.type= idtype;
r_ptr->id.data= id;
r_ptr->type= type;

@ -157,39 +157,10 @@ void RNA_def_action(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ActionGroup");
RNA_def_property_ui_text(prop, "Action Groups", "Convenient groupings of Action Channels.");
prop= RNA_def_property(srna, "timeline_markers", PROP_COLLECTION, PROP_NONE);
prop= RNA_def_property(srna, "pose_markers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
RNA_def_property_struct_type(prop, "UnknownType"); /* implement when timeline rna is wrapped */
RNA_def_property_ui_text(prop, "Timeline Markers", "Markers specific to this Action, for labeling poses.");
prop= RNA_def_property(srna, "action_show_sliders", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SLIDERS);
RNA_def_property_ui_text(prop, "Show Sliders", "Show Shape Key sliders.");
prop= RNA_def_property(srna, "action_time_units", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_DRAWTIME);
RNA_def_property_ui_text(prop, "Time Units", "Show seconds or frames in the timeline.");
prop= RNA_def_property(srna, "action_show_all", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_NOHIDE);
RNA_def_property_ui_text(prop, "Show All", "Show all channels regardless of hidden status.");
prop= RNA_def_property(srna, "action_kill_overlapping_keys", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL);
RNA_def_property_ui_text(prop, "Kill Overlapping Keys", "Remove overlapping keys after a transform.");
prop= RNA_def_property(srna, "action_key_cull_to_view", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_HORIZOPTIMISEON);
RNA_def_property_ui_text(prop, "Cull Keys to View", "Only consider keys that are within the view.");
prop= RNA_def_property(srna, "action_group_colors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_NODRAWGCOLORS);
RNA_def_property_ui_text(prop, "Group Color", "Use custom color grouping and instead of default color scheme.");
prop= RNA_def_property(srna, "action_current_frame_number", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_NODRAWCFRANUM);
RNA_def_property_ui_text(prop, "Current Frame Number", "Draw the frame number beside the current frame indicator.");
RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this Action, for labeling poses.");
}
#endif

@ -84,7 +84,7 @@ void rna_def_constraint_basedata(BlenderRNA *brna)
/* data */
srna= RNA_def_struct(brna, "Constraint", NULL );
RNA_def_struct_ui_text(srna, "Constraint", "alter the transformation of 'Objects' or 'Bones' from a number of predefined constraints");
//RNA_def_struct_refine_func(srna, "rna_Constraint_refine"); // XXX or should this go down below with the data?
RNA_def_struct_refine_func(srna, "rna_Constraint_refine");
RNA_def_struct_sdna(srna, "bConstraint");
/* strings */

@ -516,6 +516,15 @@ void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *pr
srna->nameproperty= prop;
}
void RNA_def_struct_parent(StructRNA *srna, StructRNA *parent)
{
if(DefRNA.preprocess)
srna->parent= (StructRNA*)parent->identifier;
else
srna->parent= parent;
}
void RNA_def_struct_flag(StructRNA *srna, int flag)
{
srna->flag= flag;

@ -64,6 +64,7 @@ typedef struct StructDefRNA {
struct StructDefRNA *next, *prev;
struct StructRNA *srna;
const char *filename;
const char *dnaname;
@ -142,6 +143,12 @@ void RNA_def_world(struct BlenderRNA *brna);
void rna_def_ipo_common(struct StructRNA *srna);
void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable);
void rna_ID_name_get(struct PointerRNA *ptr, char *value);
int rna_ID_name_length(struct PointerRNA *ptr);
void rna_ID_name_set(struct PointerRNA *ptr, const char *value);
struct StructRNA *rna_ID_refine(struct PointerRNA *ptr);
void rna_ID_fake_user_set(struct PointerRNA *ptr, int value);
void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index);
int rna_object_vgroup_name_index_length(struct PointerRNA *ptr, int index);
void rna_object_vgroup_name_index_set(struct PointerRNA *ptr, const char *value, short *index);

@ -205,6 +205,8 @@ typedef struct CollectionPropertyRNA {
struct StructRNA *structtype;
} CollectionPropertyRNA;
/* changes to this struct require updating rna_generate_struct in makesrna.c */
struct StructRNA {
struct StructRNA *next, *prev;
@ -227,6 +229,12 @@ struct StructRNA {
/* struct this is derivedfrom */
struct StructRNA *from;
/* only use for nested structs, where both the parent and child access
* the same C Struct but nesting is used for grouping properties.
* The parent property is used so we know NULL checks are not needed,
* and that this struct will never exist without its parent */
struct StructRNA *parent;
/* function to give the more specific type */
StructRefineFunc refine;

@ -29,6 +29,7 @@
#include "rna_internal.h"
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_meshdata_types.h"

@ -168,6 +168,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna, StructRNA *parent)
srna= RNA_def_struct(brna, "MaterialRaytraceMirror", NULL);
RNA_def_struct_sdna(srna, "Material");
RNA_def_struct_parent(srna, parent);
RNA_def_struct_ui_text(srna, "Raytrace Mirror", "");
prop= RNA_def_property(parent, "raytrace_mirror", PROP_POINTER, PROP_NONE);
@ -248,6 +249,7 @@ static void rna_def_material_raytra(BlenderRNA *brna, StructRNA *parent)
srna= RNA_def_struct(brna, "MaterialRaytraceTransparency", NULL);
RNA_def_struct_sdna(srna, "Material");
RNA_def_struct_parent(srna, parent);
RNA_def_struct_ui_text(srna, "Raytrace Transparency", "");
prop= RNA_def_property(parent, "raytrace_transparency", PROP_POINTER, PROP_NONE);
@ -334,6 +336,7 @@ static void rna_def_material_halo(BlenderRNA *brna, StructRNA *parent)
srna= RNA_def_struct(brna, "MaterialHalo", NULL);
RNA_def_struct_sdna(srna, "Material");
RNA_def_struct_parent(srna, parent);
RNA_def_struct_ui_text(srna, "Halo", "");
prop= RNA_def_property(parent, "halo", PROP_POINTER, PROP_NONE);
@ -472,6 +475,7 @@ static void rna_def_material_sss(BlenderRNA *brna, StructRNA *parent)
srna= RNA_def_struct(brna, "MaterialSubsurfaceScattering", NULL);
RNA_def_struct_sdna(srna, "Material");
RNA_def_struct_parent(srna, parent);
RNA_def_struct_ui_text(srna, "Subsurface Scattering", "");
prop= RNA_def_property(parent, "subsurface_scattering", PROP_POINTER, PROP_NONE);

@ -29,6 +29,7 @@
#include "rna_internal.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#ifdef RNA_RUNTIME

@ -33,6 +33,7 @@
#include "DNA_armature_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_bmesh.h" /* For BevelModifierData */
@ -284,7 +285,6 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna)
static void rna_def_modifier_multires(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna= RNA_def_struct(brna, "MultiresModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Multires Modifier", "");

@ -29,6 +29,8 @@
#include "rna_internal.h"
#include "DNA_customdata_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_property_types.h"
#include "DNA_scene_types.h"

@ -24,6 +24,9 @@
#include <stdlib.h>
#include "DNA_ID.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_types.h"
@ -66,6 +69,11 @@ static void *rna_Struct_base_get(PointerRNA *ptr)
return ((StructRNA*)ptr->data)->from;
}
static void *rna_Struct_parent_get(PointerRNA *ptr)
{
return ((StructRNA*)ptr->data)->parent;
}
static void *rna_Struct_name_property_get(PointerRNA *ptr)
{
return ((StructRNA*)ptr->data)->nameproperty;
@ -427,6 +435,12 @@ static void rna_def_struct(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, "rna_Struct_base_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Base", "Struct definition this is derived from.");
prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
RNA_def_property_struct_type(prop, "Struct");
RNA_def_property_pointer_funcs(prop, "rna_Struct_parent_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Parent", "Parent struct, used only for nested structs.");
prop= RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
RNA_def_property_struct_type(prop, "StringProperty");

@ -35,6 +35,7 @@
#ifdef RNA_RUNTIME
#include "BKE_context.h"
#include "BKE_global.h"
void *rna_Scene_objects_get(CollectionPropertyIterator *iter)

@ -25,6 +25,8 @@
#include <stdlib.h>
#include <limits.h>
#include "MEM_guardedalloc.h"
#include "BKE_text.h"
#include "RNA_define.h"
@ -36,18 +38,6 @@
#ifdef RNA_RUNTIME
static float rna_TextMarker_color_get(PointerRNA *ptr, int index)
{
TextMarker *marker= (TextMarker*)ptr->data;
return marker->color[index]/255.0f;
}
static void rna_TextMarker_color_set(PointerRNA *ptr, int index, float value)
{
TextMarker *marker= (TextMarker*)ptr->data;
marker->color[index] = (char)(CLAMPIS(value*255.0f, 0, 255));
}
static void rna_Text_filename_get(PointerRNA *ptr, char *value)
{
Text *text= (Text*)ptr->data;
@ -163,7 +153,6 @@ static void rna_def_text_marker(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Edit All", "Edit all markers of the same group as one.");
prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_funcs(prop, "rna_TextMarker_color_get", "rna_TextMarker_color_set", NULL);
RNA_def_property_ui_text(prop, "Color", "Color to display the marker with.");
}

File diff suppressed because it is too large Load Diff

@ -71,6 +71,7 @@ void rna_def_ambient_occlusion(BlenderRNA *brna, StructRNA *parent)
srna= RNA_def_struct(brna, "WorldAmbientOcclusion", NULL);
RNA_def_struct_sdna(srna, "World");
RNA_def_struct_parent(srna, parent);
RNA_def_struct_ui_text(srna, "Ambient Occlusion", "DOC_BROKEN");
prop= RNA_def_property(parent, "ambient_occlusion", PROP_POINTER, PROP_NONE);

@ -43,23 +43,23 @@ def rna2epy(target_path):
def write_struct(rna_struct):
def write_struct(rna_struct, structs, ident):
identifier = rna_struct.identifier
rna_base = rna_struct.base
if rna_base:
out.write('class %s(%s):\n' % (identifier, rna_base.identifier))
out.write(ident+ 'class %s(%s):\n' % (identifier, rna_base.identifier))
else:
out.write('class %s:\n' % identifier)
out.write(ident+ 'class %s:\n' % identifier)
out.write('\t"""\n')
out.write(ident+ '\t"""\n')
title = 'The %s Object' % rna_struct.name
out.write('\t%s\n' % title)
out.write('\t%s\n' % ('=' * len(title)))
out.write('\t\t%s\n' % rna_struct.description)
out.write(ident+ '\t%s\n' % title)
out.write(ident+ '\t%s\n' % ('=' * len(title)))
out.write(ident+ '\t\t%s\n' % rna_struct.description)
for rna_prop_identifier, rna_prop in rna_struct.properties.items():
@ -90,25 +90,30 @@ def rna2epy(target_path):
else: readonly_str = ' (readonly)'
if rna_prop_ptr: # Use the pointer type
out.write('\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc))
out.write('\t@type %s: %sL{%s}%s%s\n' % (rna_prop_identifier, collection_str, rna_prop_ptr.identifier, array_str, readonly_str))
out.write(ident+ '\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc))
out.write(ident+ '\t@type %s: %sL{%s}%s%s\n' % (rna_prop_identifier, collection_str, rna_prop_ptr.identifier, array_str, readonly_str))
else:
if rna_prop_type == 'enum':
out.write('\t@ivar %s: %s in (%s)\n' % (rna_prop_identifier, rna_desc, ', '.join(rna_prop.items.keys())))
out.write('\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str))
out.write(ident+ '\t@ivar %s: %s in (%s)\n' % (rna_prop_identifier, rna_desc, ', '.join(rna_prop.items.keys())))
out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str))
elif rna_prop_type == 'int' or rna_prop_type == 'float':
out.write('\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc))
out.write('\t@type %s: %s%s%s in [%s, %s]\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str, range_str(rna_prop.hard_min), range_str(rna_prop.hard_max) ))
out.write(ident+ '\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc))
out.write(ident+ '\t@type %s: %s%s%s in [%s, %s]\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str, range_str(rna_prop.hard_min), range_str(rna_prop.hard_max) ))
elif rna_prop_type == 'string':
out.write('\t@ivar %s: %s (maximum length of %s)\n' % (rna_prop_identifier, rna_desc, rna_prop.max_length))
out.write('\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str))
out.write(ident+ '\t@ivar %s: %s (maximum length of %s)\n' % (rna_prop_identifier, rna_desc, rna_prop.max_length))
out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str))
else:
out.write('\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc))
out.write('\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str))
out.write(ident+ '\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc))
out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str))
out.write('\t"""\n\n')
out.write(ident+ '\t"""\n\n')
# Now write children recursively
for child in structs:
if rna_struct == child.parent:
write_struct(child, structs, ident + '\t')
out = open(target_path, 'w')
@ -150,7 +155,11 @@ def rna2epy(target_path):
for rna_struct in structs:
write_struct(rna_struct)
if rna_struct.parent:
continue
write_struct(rna_struct, structs, '')
out.write('\n')
out.close()

Some files were not shown because too many files have changed in this diff Show More