Orange:
- Sunday merger with bf-blender - Foundations for new Node editor in Blender, generic framework that can be used for Material/Texture, Compositing, Logic or maybe even Sequencer. Note: this doesn't do anything yet, nor save! Is just to get this nice in CVS now. :)
This commit is contained in:
45
source/blender/blenkernel/BKE_node.h
Normal file
45
source/blender/blenkernel/BKE_node.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* $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. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef BKE_NODE_H
|
||||
#define BKE_NODE_H
|
||||
|
||||
struct bNodeTree;
|
||||
struct bNode;
|
||||
struct ListBase;
|
||||
|
||||
void nodeFreeNode(struct bNodeTree *ntree, struct bNode *node);
|
||||
void nodeFreeTree(struct bNodeTree *ntree);
|
||||
struct bNode *nodeAddNode(struct bNodeTree *ntree, char *name);
|
||||
|
||||
#endif
|
||||
|
||||
87
source/blender/blenkernel/intern/node.c
Normal file
87
source/blender/blenkernel/intern/node.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* $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) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "BKE_blender.h"
|
||||
#include "BKE_node.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
/* ************** Add stuff ********** */
|
||||
|
||||
bNode *nodeAddNode(struct bNodeTree *ntree, char *name)
|
||||
{
|
||||
bNode *node= MEM_callocN(sizeof(bNode), "new node");
|
||||
BLI_addtail(&ntree->nodes, node);
|
||||
BLI_strncpy(node->name, name, NODE_MAXSTR);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ************** Free stuff ********** */
|
||||
|
||||
/* goes over entire tree */
|
||||
static void node_unlink_node(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void nodeFreeNode(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
if(ntree)
|
||||
node_unlink_node(ntree, node);
|
||||
|
||||
BLI_freelistN(&node->inputs);
|
||||
BLI_freelistN(&node->outputs);
|
||||
|
||||
MEM_freeN(node);
|
||||
}
|
||||
|
||||
void nodeFreeTree(bNodeTree *ntree)
|
||||
{
|
||||
bNode *node, *next;
|
||||
|
||||
for(node= ntree->nodes.first; node; node= next) {
|
||||
next= node->next;
|
||||
nodeFreeNode(NULL, node); /* NULL -> no unlinking needed */
|
||||
}
|
||||
BLI_freelistN(&ntree->links);
|
||||
BLI_freelistN(&ntree->inputs);
|
||||
BLI_freelistN(&ntree->outputs);
|
||||
|
||||
MEM_freeN(ntree);
|
||||
}
|
||||
|
||||
@@ -3084,6 +3084,10 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
|
||||
soops->storeflag |= SO_TREESTORE_CLEANUP; // at first draw
|
||||
}
|
||||
}
|
||||
else if(sl->spacetype==SPACE_NODE) {
|
||||
SpaceNode *snode= (SpaceNode *)sl;
|
||||
snode->nodetree= NULL;
|
||||
}
|
||||
}
|
||||
|
||||
sa->v1= newdataadr(fd, sa->v1);
|
||||
@@ -4800,12 +4804,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
if(v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE;
|
||||
}
|
||||
#ifndef SHOWDEPGRAPH
|
||||
if(sl->spacetype==SPACE_OOPS) {
|
||||
else if(sl->spacetype==SPACE_OOPS) {
|
||||
if ( ((SpaceOops *)sl)->type==SO_DEPSGRAPH)
|
||||
((SpaceOops *)sl)->type=SO_OOPS;
|
||||
}
|
||||
#endif
|
||||
if(sl->spacetype==SPACE_TIME) {
|
||||
else if(sl->spacetype==SPACE_TIME) {
|
||||
SpaceTime *stime= (SpaceTime *)sl;
|
||||
if(stime->redraws==0)
|
||||
stime->redraws= TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
|
||||
|
||||
@@ -1293,6 +1293,9 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
|
||||
else if(sl->spacetype==SPACE_TIME){
|
||||
writestruct(wd, DATA, "SpaceTime", 1, sl);
|
||||
}
|
||||
else if(sl->spacetype==SPACE_NODE){
|
||||
writestruct(wd, DATA, "SpaceNode", 1, sl);
|
||||
}
|
||||
sl= sl->next;
|
||||
}
|
||||
|
||||
|
||||
@@ -300,6 +300,9 @@ extern int uiAlignPanelStep(struct ScrArea *sa, float fac);
|
||||
extern void uiPanelControl(int);
|
||||
extern void uiSetPanelHandler(int);
|
||||
|
||||
extern void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
|
||||
extern void *uiSetCurFont_ext(float aspect);
|
||||
|
||||
void shade_buttons_change_3d(void);
|
||||
|
||||
#endif /* BIF_INTERFACE_H */
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef enum {
|
||||
ICON_NLA,
|
||||
ICON_SCRIPTWIN,
|
||||
ICON_TIME,
|
||||
ICON_SPACE1,
|
||||
ICON_NODE,
|
||||
ICON_SPACE2,
|
||||
ICON_SPACE3,
|
||||
ICON_SPACE4,
|
||||
@@ -91,7 +91,7 @@ typedef enum {
|
||||
ICON_MAYBE_ITS_A_LASSO,
|
||||
ICON_BLANK1, /* ATTENTION, someone decided to use this throughout blender
|
||||
and didn't care to neither rename it nor update the PNG */
|
||||
ICON_BLANK2,
|
||||
ICON_VERSE,
|
||||
ICON_MOD_BOOLEAN,
|
||||
ICON_ARMATURE,
|
||||
ICON_PAUSE,
|
||||
|
||||
@@ -62,4 +62,5 @@ SpaceType *spacetext_get_type (void);
|
||||
SpaceType *spacescript_get_type (void);
|
||||
SpaceType *spaceview3d_get_type (void);
|
||||
SpaceType *spacetime_get_type (void);
|
||||
SpaceType *spacenode_get_type (void);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ struct SpaceIpo;
|
||||
struct Ipo;
|
||||
|
||||
/* these used to be in blender/src/headerbuttons.c: */
|
||||
#define SPACEICONMAX 15 /* See release/datafiles/blenderbuttons */
|
||||
#define SPACEICONMAX 16 /* See release/datafiles/blenderbuttons */
|
||||
#define XIC 20
|
||||
#define YIC 20
|
||||
|
||||
@@ -89,8 +89,9 @@ void seq_buttons(void);
|
||||
void sound_buttons(void);
|
||||
void text_buttons(void);
|
||||
void script_buttons(void);
|
||||
void time_buttons(struct ScrArea *sa);
|
||||
void view3d_buttons(void);
|
||||
void time_buttons(struct ScrArea *sa);
|
||||
void node_buttons(struct ScrArea *sa);
|
||||
|
||||
void do_global_buttons(unsigned short event);
|
||||
void do_global_buttons2(short event);
|
||||
@@ -108,9 +109,10 @@ void do_oops_buttons(short event);
|
||||
void do_seq_buttons(short event);
|
||||
void do_sound_buttons(unsigned short event);
|
||||
void do_text_buttons(unsigned short event);
|
||||
void do_time_buttons(struct ScrArea *sa, unsigned short event);
|
||||
void do_script_buttons(unsigned short event);
|
||||
void do_view3d_buttons(short event);
|
||||
void do_time_buttons(struct ScrArea *sa, unsigned short event);
|
||||
void do_node_buttons(struct ScrArea *sa, unsigned short event);
|
||||
|
||||
void do_headerbuttons(short event);
|
||||
|
||||
|
||||
36
source/blender/include/BSE_node.h
Normal file
36
source/blender/include/BSE_node.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* $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 opt ion) 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) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef BSE_NODE_H
|
||||
#define BSE_NODE_H
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -370,10 +370,13 @@
|
||||
#define B_TL_NEXTKEY 755
|
||||
#define B_TL_STOP 756
|
||||
|
||||
/* NLA: 801-900 */
|
||||
/* NLA: 801-850 */
|
||||
#define B_NLAHOME 801
|
||||
|
||||
/* FREE 900 - 999 */
|
||||
/* NODE: 851-900 */
|
||||
#define B_NODEHOME 851
|
||||
|
||||
/* FREE 901 - 999 */
|
||||
|
||||
|
||||
#define B_NOTHING -1
|
||||
|
||||
@@ -251,6 +251,7 @@
|
||||
#define ONLOAD_SCRIPT 0x4035
|
||||
#define SCREEN_HANDLER 0x4036
|
||||
#define REDRAWANIM 0x4037
|
||||
#define REDRAWNODE 0x4038
|
||||
|
||||
#endif /* !__MYDEVICE_H__ */
|
||||
|
||||
|
||||
86
source/blender/makesdna/DNA_node_types.h
Normal file
86
source/blender/makesdna/DNA_node_types.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* $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) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef DNA_NODE_TYPES_H
|
||||
#define DNA_NODE_TYPES_H
|
||||
|
||||
#include "DNA_vec_types.h"
|
||||
#include "DNA_listBase.h"
|
||||
|
||||
struct ID;
|
||||
struct SpaceNode;
|
||||
|
||||
#define NODE_MAXSTR 32
|
||||
|
||||
typedef struct bNodeSocket {
|
||||
struct bNodeSocket *next, *prev;
|
||||
|
||||
char name[32];
|
||||
int type, flag;
|
||||
|
||||
float locx, locy;
|
||||
|
||||
} bNodeSocket;
|
||||
|
||||
/* limit data in bNode to what we want to see saved? */
|
||||
typedef struct bNode {
|
||||
struct bNode *next, *prev;
|
||||
|
||||
char name[32];
|
||||
int type, flag;
|
||||
|
||||
ListBase inputs, outputs;
|
||||
struct ID *id; /* optional link to libdata */
|
||||
|
||||
float locx, locy; /* root offset for drawing */
|
||||
rctf tot; /* entire boundbox */
|
||||
rctf prv; /* optional preview area */
|
||||
|
||||
int (*drawfunc)(struct SpaceNode *, struct bNode *);
|
||||
|
||||
} bNode;
|
||||
|
||||
typedef struct bNodeLink {
|
||||
struct bNodeLink *next, *prev;
|
||||
|
||||
bNode *from, *to;
|
||||
|
||||
} bNodeLink;
|
||||
|
||||
/* the basis for a Node tree, all links and nodes reside internal here */
|
||||
typedef struct bNodeTree {
|
||||
ListBase nodes, links;
|
||||
|
||||
ListBase inputs, outputs; /* default inputs and outputs, for solving tree */
|
||||
|
||||
} bNodeTree;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -172,11 +172,12 @@ enum {
|
||||
SPACE_ACTION,
|
||||
SPACE_NLA,
|
||||
SPACE_SCRIPT,
|
||||
SPACE_TIME
|
||||
SPACE_TIME,
|
||||
SPACE_NODE
|
||||
/* SPACE_LOGIC */
|
||||
};
|
||||
|
||||
/* Adding a new space type? Change SPACEICONMAX in headerbuttons.c */
|
||||
/* Adding a new space type? Change SPACEICONMAX in BSE_headerbuttons.h */
|
||||
/* -- should rather handle this with the above enum... */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ struct Image;
|
||||
struct SpaceIpo;
|
||||
struct BlendHandle;
|
||||
struct TreeStore;
|
||||
|
||||
struct bNodeTree;
|
||||
|
||||
/**
|
||||
* The base structure all the other spaces
|
||||
@@ -292,6 +292,23 @@ typedef struct SpaceTime {
|
||||
|
||||
} SpaceTime;
|
||||
|
||||
typedef struct SpaceNode {
|
||||
SpaceLink *next, *prev;
|
||||
int spacetype;
|
||||
float blockscale;
|
||||
struct ScrArea *area;
|
||||
|
||||
View2D v2d;
|
||||
|
||||
struct ID *from;
|
||||
int flag;
|
||||
float aspect;
|
||||
void *curfont;
|
||||
|
||||
struct bNodeTree *nodetree;
|
||||
|
||||
} SpaceNode;
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -123,6 +123,7 @@ char *includefiles[] = {
|
||||
"DNA_action_types.h",
|
||||
"DNA_constraint_types.h",
|
||||
"DNA_nla_types.h",
|
||||
"DNA_node_types.h",
|
||||
// if you add files here, please add them at the end
|
||||
// of makesdna.c (this file) as well
|
||||
|
||||
@@ -1129,4 +1130,5 @@ int main(int argc, char ** argv)
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_nla_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
/* end of list */
|
||||
|
||||
@@ -126,7 +126,7 @@ static PyObject *M_Image_New( PyObject * self, PyObject * args)
|
||||
if( !img )
|
||||
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
||||
"couldn't create PyObject Image_Type" ) );
|
||||
// image_changed(img, 0);
|
||||
|
||||
return Image_CreatePyObject( img );
|
||||
}
|
||||
|
||||
@@ -894,9 +894,6 @@ static PyObject *Image_reload( BPy_Image * self )
|
||||
|
||||
free_image_buffers( img ); /* force read again */
|
||||
img->ok = 1;
|
||||
if( G.sima )
|
||||
image_changed( G.sima, 0 );
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@@ -1104,12 +1101,10 @@ static PyObject *Image_getAttr( BPy_Image * self, char *name )
|
||||
attr = PyInt_FromLong( self->image->animspeed );
|
||||
else if( strcmp( name, "packed" ) == 0 ) {
|
||||
if (self->image->packedfile) {
|
||||
attr = Py_True;
|
||||
attr = EXPP_incr_ret_True();
|
||||
} else {
|
||||
attr = Py_False;
|
||||
attr = EXPP_incr_ret_False();
|
||||
}
|
||||
Py_INCREF(attr);
|
||||
|
||||
} else if( strcmp( name, "bindcode" ) == 0 )
|
||||
attr = PyInt_FromLong( self->image->bindcode );
|
||||
else if( strcmp( name, "users" ) == 0 )
|
||||
|
||||
@@ -117,6 +117,12 @@
|
||||
#define EXPP_LAMP_COL_MIN 0.0
|
||||
#define EXPP_LAMP_COL_MAX 1.0
|
||||
|
||||
/* Raytracing settings */
|
||||
#define EXPP_LAMP_RAYSAMPLES_MIN 1
|
||||
#define EXPP_LAMP_RAYSAMPLES_MAX 16
|
||||
#define EXPP_LAMP_AREASIZE_MIN 0.01
|
||||
#define EXPP_LAMP_AREASIZE_MAX 100.0
|
||||
|
||||
/* Lamp_setComponent() keys for which color to get/set */
|
||||
#define EXPP_LAMP_COMP_R 0x00
|
||||
#define EXPP_LAMP_COMP_G 0x01
|
||||
@@ -177,6 +183,10 @@ static PyObject *Lamp_getTypesConst( void );
|
||||
static PyObject *Lamp_getMode( BPy_Lamp * self );
|
||||
static PyObject *Lamp_getModesConst( void );
|
||||
static PyObject *Lamp_getSamples( BPy_Lamp * self );
|
||||
static PyObject *Lamp_getRaySamplesX( BPy_Lamp * self );
|
||||
static PyObject *Lamp_getRaySamplesY( BPy_Lamp * self );
|
||||
static PyObject *Lamp_getAreaSizeX( BPy_Lamp * self );
|
||||
static PyObject *Lamp_getAreaSizeY( BPy_Lamp * self );
|
||||
static PyObject *Lamp_getBufferSize( BPy_Lamp * self );
|
||||
static PyObject *Lamp_getHaloStep( BPy_Lamp * self );
|
||||
static PyObject *Lamp_getEnergy( BPy_Lamp * self );
|
||||
@@ -201,6 +211,10 @@ static PyObject *Lamp_oldsetName( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetType( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetMode( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetSamples( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetRaySamplesX( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetRaySamplesY( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetAreaSizeX( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetAreaSizeY( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetBufferSize( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetHaloStep( BPy_Lamp * self, PyObject * args );
|
||||
static PyObject *Lamp_oldsetEnergy( BPy_Lamp * self, PyObject * args );
|
||||
@@ -220,6 +234,10 @@ static int Lamp_setName( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setType( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setMode( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setSamples( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setRaySamplesX( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setRaySamplesY( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setAreaSizeX( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setAreaSizeY( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setBufferSize( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setHaloStep( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setEnergy( BPy_Lamp * self, PyObject * args );
|
||||
@@ -252,6 +270,14 @@ static PyMethodDef BPy_Lamp_methods[] = {
|
||||
"() - return Lamp mode flags (or'ed value)"},
|
||||
{"getSamples", ( PyCFunction ) Lamp_getSamples, METH_NOARGS,
|
||||
"() - return Lamp samples value"},
|
||||
{"getRaySamplesX", ( PyCFunction ) Lamp_getRaySamplesX, METH_NOARGS,
|
||||
"() - return Lamp raytracing samples on the X axis"},
|
||||
{"getRaySamplesY", ( PyCFunction ) Lamp_getRaySamplesY, METH_NOARGS,
|
||||
"() - return Lamp raytracing samples on the Y axis"},
|
||||
{"getAreaSizeX", ( PyCFunction ) Lamp_getAreaSizeX, METH_NOARGS,
|
||||
"() - return Lamp area size on the X axis"},
|
||||
{"getAreaSizeY", ( PyCFunction ) Lamp_getAreaSizeY, METH_NOARGS,
|
||||
"() - return Lamp area size on the Y axis"},
|
||||
{"getBufferSize", ( PyCFunction ) Lamp_getBufferSize, METH_NOARGS,
|
||||
"() - return Lamp buffer size value"},
|
||||
{"getHaloStep", ( PyCFunction ) Lamp_getHaloStep, METH_NOARGS,
|
||||
@@ -288,6 +314,14 @@ static PyMethodDef BPy_Lamp_methods[] = {
|
||||
"([up to eight str's]) - Set Lamp mode flag(s)"},
|
||||
{"setSamples", ( PyCFunction ) Lamp_oldsetSamples, METH_VARARGS,
|
||||
"(int) - change Lamp samples value"},
|
||||
{"setRaySamplesX", ( PyCFunction ) Lamp_oldsetRaySamplesX, METH_VARARGS,
|
||||
"(int) - change Lamp ray X samples value in [1,16]"},
|
||||
{"setRaySamplesY", ( PyCFunction ) Lamp_oldsetRaySamplesY, METH_VARARGS,
|
||||
"(int) - change Lamp ray Y samples value in [1,16]"},
|
||||
{"setAreaSizeX", ( PyCFunction ) Lamp_oldsetAreaSizeX, METH_VARARGS,
|
||||
"(float) - change Lamp ray X size for area lamps, value in [0.01, 100.0]"},
|
||||
{"setAreaSizeY", ( PyCFunction ) Lamp_oldsetAreaSizeY, METH_VARARGS,
|
||||
"(float) - change Lamp ray Y size for area lamps, value in [0.01, 100.0]"},
|
||||
{"setBufferSize", ( PyCFunction ) Lamp_oldsetBufferSize, METH_VARARGS,
|
||||
"(int) - change Lamp buffer size value"},
|
||||
{"setHaloStep", ( PyCFunction ) Lamp_oldsetHaloStep, METH_VARARGS,
|
||||
@@ -404,6 +438,22 @@ static PyGetSetDef BPy_Lamp_getseters[] = {
|
||||
(getter)Lamp_getSamples, (setter)Lamp_setSamples,
|
||||
"Lamp shadow map samples",
|
||||
NULL},
|
||||
{"raySamplesX",
|
||||
(getter)Lamp_getRaySamplesX, (setter)Lamp_setRaySamplesX,
|
||||
"Lamp raytracing samples on the X axis",
|
||||
NULL},
|
||||
{"raySamplesY",
|
||||
(getter)Lamp_getRaySamplesY, (setter)Lamp_setRaySamplesY,
|
||||
"Lamp raytracing samples on the Y axis",
|
||||
NULL},
|
||||
{"areaSizeX",
|
||||
(getter)Lamp_getAreaSizeX, (setter)Lamp_setAreaSizeX,
|
||||
"Lamp X size for an arealamp",
|
||||
NULL},
|
||||
{"areaSizeY",
|
||||
(getter)Lamp_getAreaSizeY, (setter)Lamp_setAreaSizeY,
|
||||
"Lamp Y size for an arealamp",
|
||||
NULL},
|
||||
{"softness",
|
||||
(getter)Lamp_getSoftness, (setter)Lamp_setSoftness,
|
||||
"Lamp shadow sample area size",
|
||||
@@ -889,6 +939,49 @@ static PyObject *Lamp_getSamples( BPy_Lamp * self )
|
||||
"couldn't get Lamp.samples attribute" ) );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_getRaySamplesX( BPy_Lamp * self )
|
||||
{
|
||||
PyObject *attr = PyInt_FromLong( self->lamp->ray_samp );
|
||||
|
||||
if( attr )
|
||||
return attr;
|
||||
|
||||
return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"couldn't get Lamp.raySamplesX attribute" ) );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_getRaySamplesY( BPy_Lamp * self )
|
||||
{
|
||||
PyObject *attr = PyInt_FromLong( self->lamp->ray_sampy );
|
||||
|
||||
if( attr )
|
||||
return attr;
|
||||
|
||||
return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"couldn't get Lamp.raySamplesY attribute" ) );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_getAreaSizeX( BPy_Lamp * self )
|
||||
{
|
||||
PyObject *attr = PyFloat_FromDouble( self->lamp->area_size );
|
||||
if( attr )
|
||||
return attr;
|
||||
|
||||
return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"couldn't get Lamp.areaSizeX attribute" ) );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_getAreaSizeY( BPy_Lamp * self )
|
||||
{
|
||||
PyObject *attr = PyFloat_FromDouble( self->lamp->area_sizey );
|
||||
|
||||
if( attr )
|
||||
return attr;
|
||||
|
||||
return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"couldn't get Lamp.areaSizeY attribute" ) );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_getBufferSize( BPy_Lamp * self )
|
||||
{
|
||||
PyObject *attr = PyInt_FromLong( self->lamp->bufsize );
|
||||
@@ -1097,6 +1190,35 @@ static int Lamp_setSamples( BPy_Lamp * self, PyObject * value )
|
||||
EXPP_LAMP_SAMPLES_MAX, 'h' );
|
||||
}
|
||||
|
||||
|
||||
static int Lamp_setRaySamplesX( BPy_Lamp * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setIValueClamped ( value, &self->lamp->ray_samp,
|
||||
EXPP_LAMP_RAYSAMPLES_MIN,
|
||||
EXPP_LAMP_RAYSAMPLES_MAX, 'h' );
|
||||
}
|
||||
|
||||
static int Lamp_setRaySamplesY( BPy_Lamp * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setIValueClamped ( value, &self->lamp->ray_sampy,
|
||||
EXPP_LAMP_RAYSAMPLES_MIN,
|
||||
EXPP_LAMP_RAYSAMPLES_MAX, 'h' );
|
||||
}
|
||||
|
||||
static int Lamp_setAreaSizeX( BPy_Lamp * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setFloatClamped ( value, &self->lamp->area_size,
|
||||
EXPP_LAMP_AREASIZE_MIN,
|
||||
EXPP_LAMP_AREASIZE_MAX );
|
||||
}
|
||||
|
||||
static int Lamp_setAreaSizeY( BPy_Lamp * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setFloatClamped ( value, &self->lamp->area_sizey,
|
||||
EXPP_LAMP_AREASIZE_MIN,
|
||||
EXPP_LAMP_AREASIZE_MAX );
|
||||
}
|
||||
|
||||
static int Lamp_setBufferSize( BPy_Lamp * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setIValueClamped ( value, &self->lamp->bufsize,
|
||||
@@ -1480,6 +1602,26 @@ static PyObject *Lamp_oldsetSamples( BPy_Lamp * self, PyObject * args )
|
||||
return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setSamples );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_oldsetRaySamplesX( BPy_Lamp * self, PyObject * args )
|
||||
{
|
||||
return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setRaySamplesX );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_oldsetRaySamplesY( BPy_Lamp * self, PyObject * args )
|
||||
{
|
||||
return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setRaySamplesY );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_oldsetAreaSizeX( BPy_Lamp * self, PyObject * args )
|
||||
{
|
||||
return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setAreaSizeX );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_oldsetAreaSizeY( BPy_Lamp * self, PyObject * args )
|
||||
{
|
||||
return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setAreaSizeY );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_oldsetBufferSize( BPy_Lamp * self, PyObject * args )
|
||||
{
|
||||
return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setBufferSize );
|
||||
|
||||
@@ -118,6 +118,18 @@ class Lamp:
|
||||
@ivar samples: Lamp shadow map samples.
|
||||
Value is clamped to the range [1,16].
|
||||
@type samples: int
|
||||
@ivar raySamplesX: Lamp raytracing X samples (X is used for the Y axis with square area lamps).
|
||||
Value is clamped to the range [1,16].
|
||||
@type raySamplesX: int
|
||||
@ivar raySamplesY: Lamp raytracing Y samples (Y is only used for rectangle area lamps).
|
||||
Value is clamped to the range [1,16].
|
||||
@type raySamplesY: int
|
||||
@ivar areaSizeX: Lamp X size (X is used for the Y axis with square area lamps)
|
||||
Value is clamped to the range [0.01,100.0].
|
||||
@type areaSizeX: float
|
||||
@ivar areaSizeY: Lamp Y size (Y is only used for rectangle area lamps).
|
||||
Value is clamped to the range [0.01,100.0].
|
||||
@type areaSizeY: float
|
||||
@ivar softness: Lamp shadow sample area size.
|
||||
Value is clamped to the range [1.0,100.0].
|
||||
@type softness: float
|
||||
@@ -201,6 +213,62 @@ class Lamp:
|
||||
@param samples: The new samples value.
|
||||
"""
|
||||
|
||||
def getRaySamplesX():
|
||||
"""
|
||||
Get this lamp's raytracing sample value on the X axis.
|
||||
This value is only used for area lamps.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setRaySamplesX():
|
||||
"""
|
||||
Set the lamp's raytracing sample value on the X axis, between 1 and 16.
|
||||
This value is only used for area lamps.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def getRaySamplesY():
|
||||
"""
|
||||
Get this lamp's raytracing sample value on the Y axis.
|
||||
This value is only used for rectangle area lamps.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setRaySamplesY():
|
||||
"""
|
||||
Set the lamp's raytracing sample value on the Y axis, between 1 and 16.
|
||||
This value is only used for rectangle area lamps.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def getAreaSizeX():
|
||||
"""
|
||||
Get this lamp's size on the X axis.
|
||||
This value is only used for area lamps.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setAreaSizeX():
|
||||
"""
|
||||
Set this lamp's size on the X axis.
|
||||
This value is only used for area lamps.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def getAreaSizeY():
|
||||
"""
|
||||
Get this lamp's size on the Y axis.
|
||||
This value is only used for rectangle area lamps.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setAreaSizeY():
|
||||
"""
|
||||
Set this lamp's size on the Y axis.
|
||||
This value is only used for rectangle area lamps.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def getBufferSize():
|
||||
"""
|
||||
Get this lamp's buffer size.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2220,12 +2220,11 @@ static void object_panel_fluidsim(Object *ob)
|
||||
|
||||
if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
|
||||
|
||||
if(ob->type==OB_MESH) {
|
||||
uiDefButBitS(block, TOG, OB_FLUIDSIM_ENABLE, REDRAWBUTSOBJECT, "Enable", 0,yline, 75,objHeight,
|
||||
&ob->fluidsimFlag, 0, 0, 0, 0, "Sets object to participate in fluid simulation");
|
||||
|
||||
if(ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) {
|
||||
|
||||
if(ob->type==OB_MESH) {
|
||||
FluidsimSettings *fss= ob->fluidsimSettings;
|
||||
|
||||
if(fss==NULL) {
|
||||
@@ -2358,12 +2357,12 @@ static void object_panel_fluidsim(Object *ob)
|
||||
|
||||
} else {
|
||||
yline -= lineHeight + 5;
|
||||
uiDefBut(block, LABEL, 0, "Sorry - only meshes supported", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
uiDefBut(block, LABEL, 0, "Object not enabled for fluid simulation...", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
yline -= lineHeight;
|
||||
}
|
||||
} else {
|
||||
yline -= lineHeight + 5;
|
||||
uiDefBut(block, LABEL, 0, "Object not enabled for fluid simulation...", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
uiDefBut(block, LABEL, 0, "Only Mesh Objects can participate", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
yline -= lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
129
source/blender/src/drawnode.c
Normal file
129
source/blender/src/drawnode.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* $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) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_interface.h"
|
||||
#include "BIF_mywindow.h"
|
||||
#include "BIF_resources.h"
|
||||
#include "BIF_screen.h"
|
||||
|
||||
#include "BSE_drawipo.h"
|
||||
#include "BSE_view.h"
|
||||
#include "BMF_Api.h"
|
||||
|
||||
#include "blendef.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
static void draw_nodespace_grid(SpaceNode *snode)
|
||||
{
|
||||
// float fac, step= 20.0f;
|
||||
|
||||
/* window is 'pixel size', like buttons */
|
||||
|
||||
BIF_ThemeColorShade(TH_BACK, 10);
|
||||
|
||||
glRectf(0.0f, 0.0f, curarea->winx, curarea->winy);
|
||||
}
|
||||
|
||||
|
||||
/* get from assigned ID */
|
||||
static void get_nodetree(SpaceNode *snode)
|
||||
{
|
||||
/* note: once proper coded, remove free from freespacelist() */
|
||||
if(snode->nodetree==NULL) {
|
||||
snode->nodetree= MEM_callocN(sizeof(bNodeTree), "new node tree");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void drawnodespace(ScrArea *sa, void *spacedata)
|
||||
{
|
||||
SpaceNode *snode= sa->spacedata.first;
|
||||
float col[3];
|
||||
|
||||
BIF_GetThemeColor3fv(TH_BACK, col);
|
||||
glClearColor(col[0], col[1], col[2], 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
calc_scrollrcts(sa, &(snode->v2d), sa->winx, sa->winy);
|
||||
|
||||
myortho2(snode->v2d.cur.xmin, snode->v2d.cur.xmax, snode->v2d.cur.ymin, snode->v2d.cur.ymax);
|
||||
bwin_clear_viewmat(sa->win); /* clear buttons view */
|
||||
glLoadIdentity();
|
||||
|
||||
/* only set once */
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
|
||||
/* aspect+font, set each time */
|
||||
snode->aspect= (snode->v2d.cur.xmax - snode->v2d.cur.xmin)/((float)sa->winx);
|
||||
snode->curfont= uiSetCurFont_ext(snode->aspect);
|
||||
|
||||
/* backdrop */
|
||||
draw_nodespace_grid(snode);
|
||||
|
||||
/* nodes */
|
||||
get_nodetree(snode);
|
||||
if(snode->nodetree) {
|
||||
bNode *node;
|
||||
for(node= snode->nodetree->nodes.first; node; node= node->next) {
|
||||
node->drawfunc(snode, node);
|
||||
}
|
||||
}
|
||||
|
||||
/* restore viewport */
|
||||
mywinset(sa->win);
|
||||
|
||||
/* ortho at pixel level curarea */
|
||||
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
|
||||
|
||||
draw_area_emboss(sa);
|
||||
curarea->win_swap= WIN_BACK_OK;
|
||||
}
|
||||
@@ -1,15 +1,12 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -27,7 +24,7 @@
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
379
source/blender/src/editnode.c
Normal file
379
source/blender/src/editnode.c
Normal file
@@ -0,0 +1,379 @@
|
||||
/**
|
||||
* $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) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_interface.h"
|
||||
#include "BIF_language.h"
|
||||
#include "BIF_mywindow.h"
|
||||
#include "BIF_resources.h"
|
||||
#include "BIF_space.h"
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_toolbox.h"
|
||||
|
||||
#include "BSE_drawipo.h"
|
||||
#include "BSE_headerbuttons.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "blendef.h"
|
||||
#include "interface.h" /* urm... for rasterpos_safe, roundbox */
|
||||
|
||||
#include "mydevice.h"
|
||||
|
||||
|
||||
/* ***************************** */
|
||||
|
||||
#define NODE_DY 20
|
||||
|
||||
static void nodeshadow(rctf *rct, int select)
|
||||
{
|
||||
int a;
|
||||
char alpha= 2;
|
||||
|
||||
uiSetRoundBox(15);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
if(select) a= 10; else a=7;
|
||||
for(; a>0; a-=1) {
|
||||
/* alpha ranges from 2 to 20 or so */
|
||||
glColor4ub(0, 0, 0, alpha);
|
||||
alpha+= 2;
|
||||
|
||||
gl_round_box(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax-10.0f + a, 8.0f+a);
|
||||
}
|
||||
|
||||
/* outline emphasis */
|
||||
glEnable( GL_LINE_SMOOTH );
|
||||
glColor4ub(0, 0, 0, 100);
|
||||
gl_round_box(GL_LINE_LOOP, rct->xmin-0.5f, rct->ymin-0.5f, rct->xmax+0.5f, rct->ymax+0.5f, 8.0f);
|
||||
glDisable( GL_LINE_SMOOTH );
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
/* nice AA filled circle */
|
||||
static void socket_circle_draw(float x, float y, float size)
|
||||
{
|
||||
/* 16 values of sin function */
|
||||
static float si[16] = {
|
||||
0.00000000, 0.39435585,0.72479278,0.93775213,
|
||||
0.99871650,0.89780453,0.65137248,0.29936312,
|
||||
-0.10116832,-0.48530196,-0.79077573,-0.96807711,
|
||||
-0.98846832,-0.84864425,-0.57126821,-0.20129852
|
||||
};
|
||||
/* 16 values of cos function */
|
||||
static float co[16] ={
|
||||
1.00000000,0.91895781,0.68896691,0.34730525,
|
||||
-0.05064916,-0.44039415,-0.75875812,-0.95413925,
|
||||
-0.99486932,-0.87434661,-0.61210598,-0.25065253,
|
||||
0.15142777,0.52896401,0.82076344,0.97952994,
|
||||
};
|
||||
int a;
|
||||
|
||||
glColor3ub(200, 200, 40);
|
||||
glBegin(GL_POLYGON);
|
||||
for(a=0; a<16; a++)
|
||||
glVertex2f(x+size*si[a], y+size*co[a]);
|
||||
glEnd();
|
||||
|
||||
glColor4ub(0, 0, 0, 150);
|
||||
glEnable(GL_BLEND);
|
||||
glEnable( GL_LINE_SMOOTH );
|
||||
glBegin(GL_LINE_LOOP);
|
||||
for(a=0; a<16; a++)
|
||||
glVertex2f(x+size*si[a], y+size*co[a]);
|
||||
glEnd();
|
||||
glDisable( GL_LINE_SMOOTH );
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
static int node_basis_draw(SpaceNode *snode, bNode *node)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
rctf *rct= &node->tot;
|
||||
float slen;
|
||||
int trans= (U.transopts & USER_TR_BUTTONS);
|
||||
|
||||
nodeshadow(rct, node->flag & SELECT);
|
||||
|
||||
BIF_ThemeColorShade(TH_HEADER, +30);
|
||||
uiSetRoundBox(3);
|
||||
uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, 8);
|
||||
|
||||
BIF_ThemeColorShade(TH_HEADER, +10);
|
||||
uiSetRoundBox(12);
|
||||
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax-NODE_DY, 8);
|
||||
|
||||
ui_rasterpos_safe(rct->xmin+4.0f, rct->ymax-NODE_DY+5.0f, snode->aspect);
|
||||
|
||||
if(node->flag & SELECT)
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
|
||||
BIF_DrawString(snode->curfont, node->name, trans);
|
||||
|
||||
for(sock= node->inputs.first; sock; sock= sock->next) {
|
||||
socket_circle_draw(sock->locx, sock->locy, 5.0f);
|
||||
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
ui_rasterpos_safe(sock->locx+8.0f, sock->locy-5.0f, snode->aspect);
|
||||
BIF_DrawString(snode->curfont, sock->name, trans);
|
||||
}
|
||||
|
||||
for(sock= node->outputs.first; sock; sock= sock->next) {
|
||||
socket_circle_draw(sock->locx, sock->locy, 5.0f);
|
||||
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
slen= snode->aspect*BIF_GetStringWidth(snode->curfont, sock->name, trans);
|
||||
ui_rasterpos_safe(sock->locx-8.0f-slen, sock->locy-5.0f, snode->aspect);
|
||||
BIF_DrawString(snode->curfont, sock->name, trans);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void node_deselectall(SpaceNode *snode, int swap)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
if(swap) {
|
||||
for(node= snode->nodetree->nodes.first; node; node= node->next)
|
||||
if(node->flag & SELECT)
|
||||
break;
|
||||
if(node==NULL) {
|
||||
for(node= snode->nodetree->nodes.first; node; node= node->next)
|
||||
node->flag |= SELECT;
|
||||
allqueue(REDRAWNODE, 0);
|
||||
return;
|
||||
}
|
||||
/* else pass on to deselect */
|
||||
}
|
||||
|
||||
for(node= snode->nodetree->nodes.first; node; node= node->next)
|
||||
node->flag &= ~SELECT;
|
||||
|
||||
allqueue(REDRAWNODE, 0);
|
||||
}
|
||||
|
||||
|
||||
/* based on settings in tree and node,
|
||||
- it fills it with appropriate callbacks
|
||||
- sets drawing rect info */
|
||||
void node_update(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
bNodeSocket *nsock;
|
||||
float dy= 0.0f;
|
||||
float width= 80.0f; /* width custom? */
|
||||
|
||||
node->drawfunc= node_basis_draw;
|
||||
|
||||
/* input connectors */
|
||||
for(nsock= node->inputs.last; nsock; nsock= nsock->prev) {
|
||||
nsock->locx= node->locx;
|
||||
nsock->locy= node->locy + dy + NODE_DY/2;
|
||||
dy+= NODE_DY;
|
||||
}
|
||||
|
||||
/* spacer */
|
||||
dy+= NODE_DY/2;
|
||||
|
||||
/* preview rect? */
|
||||
|
||||
/* spacer */
|
||||
dy+= NODE_DY/2;
|
||||
|
||||
/* output connectors */
|
||||
for(nsock= node->outputs.last; nsock; nsock= nsock->prev) {
|
||||
nsock->locx= node->locx + width;
|
||||
nsock->locy= node->locy + dy + NODE_DY/2;
|
||||
dy+= NODE_DY;
|
||||
}
|
||||
|
||||
/* header */
|
||||
dy+= NODE_DY;
|
||||
|
||||
node->tot.xmin= node->locx;
|
||||
node->tot.xmax= node->locx + width;
|
||||
node->tot.ymin= node->locy;
|
||||
node->tot.ymax= node->locy + dy;
|
||||
}
|
||||
|
||||
/* editor context */
|
||||
static void node_add_menu(SpaceNode *snode)
|
||||
{
|
||||
short event, mval[2];
|
||||
|
||||
getmouseco_areawin(mval);
|
||||
|
||||
event= pupmenu("Add Node%t|Testnode%x1");
|
||||
if(event<1) return;
|
||||
|
||||
node_deselectall(snode, 0);
|
||||
|
||||
if(event==1) {
|
||||
bNodeSocket *sock;
|
||||
bNode *node= nodeAddNode(snode->nodetree, "TestNode");
|
||||
|
||||
areamouseco_to_ipoco(G.v2d, mval, &node->locx, &node->locy);
|
||||
node->flag= SELECT;
|
||||
|
||||
/* add fake sockets */
|
||||
sock= MEM_callocN(sizeof(bNodeSocket), "sock");
|
||||
strcpy(sock->name, "Col");
|
||||
BLI_addtail(&node->inputs, sock);
|
||||
sock= MEM_callocN(sizeof(bNodeSocket), "sock");
|
||||
strcpy(sock->name, "Spec");
|
||||
BLI_addtail(&node->inputs, sock);
|
||||
|
||||
sock= MEM_callocN(sizeof(bNodeSocket), "sock");
|
||||
strcpy(sock->name, "Diffuse");
|
||||
BLI_addtail(&node->outputs, sock);
|
||||
|
||||
node_update(snode->nodetree, node);
|
||||
|
||||
allqueue(REDRAWNODE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_select(SpaceNode *snode)
|
||||
{
|
||||
bNode *node;
|
||||
float mx, my;
|
||||
short mval[2];
|
||||
|
||||
getmouseco_areawin(mval);
|
||||
areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
|
||||
|
||||
if((G.qual & LR_SHIFTKEY)==0)
|
||||
node_deselectall(snode, 0);
|
||||
|
||||
for(node= snode->nodetree->nodes.first; node; node= node->next) {
|
||||
if(BLI_in_rctf(&node->tot, mx, my)) {
|
||||
node->flag |= SELECT;
|
||||
}
|
||||
}
|
||||
allqueue(REDRAWNODE, 0);
|
||||
}
|
||||
|
||||
|
||||
void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
{
|
||||
SpaceNode *snode= spacedata;
|
||||
float dx;
|
||||
unsigned short event= evt->event;
|
||||
short val= evt->val, doredraw=0;
|
||||
|
||||
if(sa->win==0) return;
|
||||
|
||||
if(val) {
|
||||
|
||||
if( uiDoBlocks(&sa->uiblocks, event)!=UI_NOTHING ) event= 0;
|
||||
|
||||
switch(event) {
|
||||
case LEFTMOUSE:
|
||||
node_select(snode);
|
||||
break;
|
||||
|
||||
case RIGHTMOUSE:
|
||||
node_select(snode);
|
||||
|
||||
break;
|
||||
case MIDDLEMOUSE:
|
||||
case WHEELUPMOUSE:
|
||||
case WHEELDOWNMOUSE:
|
||||
view2dmove(event); /* in drawipo.c */
|
||||
break;
|
||||
case PADPLUSKEY:
|
||||
dx= (float)(0.1154*(G.v2d->cur.xmax-G.v2d->cur.xmin));
|
||||
G.v2d->cur.xmin+= dx;
|
||||
G.v2d->cur.xmax-= dx;
|
||||
test_view2d(G.v2d, sa->winx, sa->winy);
|
||||
doredraw= 1;
|
||||
break;
|
||||
case PADMINUS:
|
||||
dx= (float)(0.15*(G.v2d->cur.xmax-G.v2d->cur.xmin));
|
||||
G.v2d->cur.xmin-= dx;
|
||||
G.v2d->cur.xmax+= dx;
|
||||
test_view2d(G.v2d, sa->winx, sa->winy);
|
||||
doredraw= 1;
|
||||
break;
|
||||
case HOMEKEY:
|
||||
doredraw= 1;
|
||||
break;
|
||||
|
||||
case AKEY:
|
||||
if(G.qual==LR_SHIFTKEY)
|
||||
node_add_menu(snode);
|
||||
else if(G.qual==0)
|
||||
node_deselectall(snode, 1);
|
||||
break;
|
||||
case DKEY:
|
||||
break;
|
||||
case CKEY:
|
||||
break;
|
||||
case GKEY:
|
||||
break;
|
||||
case DELKEY:
|
||||
case XKEY:
|
||||
if( okee("Erase selected")==0 ) break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(doredraw)
|
||||
scrarea_queue_winredraw(sa);
|
||||
}
|
||||
|
||||
|
||||
@@ -332,6 +332,12 @@ void areawinset(short win)
|
||||
G.v2d= &stime->v2d;
|
||||
}
|
||||
break;
|
||||
case SPACE_NODE:
|
||||
{
|
||||
SpaceNode *snode= curarea->spacedata.first;
|
||||
G.v2d= &snode->v2d;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -400,6 +406,7 @@ void scrarea_do_headdraw(ScrArea *area)
|
||||
case SPACE_ACTION: action_buttons(); break;
|
||||
case SPACE_NLA: nla_buttons(); break;
|
||||
case SPACE_TIME: time_buttons(area); break;
|
||||
case SPACE_NODE: node_buttons(area); break;
|
||||
}
|
||||
uiClearButLock();
|
||||
|
||||
@@ -647,7 +654,6 @@ int is_allowed_to_change_screen(bScreen *new)
|
||||
|
||||
void splash(void *data, int datasize, char *string)
|
||||
{
|
||||
extern void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
|
||||
ImBuf *bbuf;
|
||||
int oldwin;
|
||||
short val;
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -27,7 +24,7 @@
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
#include "BSE_headerbuttons.h"
|
||||
|
||||
#include "mydevice.h"
|
||||
#include "render.h" // for RE_make_existing_file
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_thread.h"
|
||||
|
||||
126
source/blender/src/header_node.c
Normal file
126
source/blender/src/header_node.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/**
|
||||
*
|
||||
* $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) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_view2d_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_interface.h"
|
||||
#include "BIF_resources.h"
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_space.h"
|
||||
#include "BIF_toolbox.h"
|
||||
#include "BIF_butspace.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
|
||||
#include "BSE_headerbuttons.h"
|
||||
|
||||
#include "blendef.h"
|
||||
#include "butspace.h"
|
||||
#include "mydevice.h"
|
||||
|
||||
void do_node_buttons(ScrArea *sa, unsigned short event)
|
||||
{
|
||||
// SpaceNode *snode= sa->spacedata.first;
|
||||
|
||||
switch(event) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void node_buttons(ScrArea *sa)
|
||||
{
|
||||
// SpaceNode *snode= sa->spacedata.first;
|
||||
uiBlock *block;
|
||||
short xco;
|
||||
char name[256];
|
||||
|
||||
sprintf(name, "header %d", sa->headwin);
|
||||
block= uiNewBlock(&sa->uiblocks, name, UI_EMBOSS, UI_HELV, sa->headwin);
|
||||
|
||||
if(area_is_active_area(sa)) uiBlockSetCol(block, TH_HEADER);
|
||||
else uiBlockSetCol(block, TH_HEADERDESEL);
|
||||
|
||||
sa->butspacetype= SPACE_NODE;
|
||||
|
||||
xco = 8;
|
||||
|
||||
uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
|
||||
windowtype_pup(), xco, 0, XIC+10, YIC,
|
||||
&(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
|
||||
"Displays Current Window Type. "
|
||||
"Click for menu of available types.");
|
||||
|
||||
xco += XIC + 14;
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
if (sa->flag & HEADER_NO_PULLDOWN) {
|
||||
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
|
||||
ICON_DISCLOSURE_TRI_RIGHT,
|
||||
xco,2,XIC,YIC-2,
|
||||
&(sa->flag), 0, 0, 0, 0,
|
||||
"Show pulldown menus");
|
||||
}
|
||||
else {
|
||||
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
|
||||
ICON_DISCLOSURE_TRI_DOWN,
|
||||
xco,2,XIC,YIC-2,
|
||||
&(sa->flag), 0, 0, 0, 0,
|
||||
"Hide pulldown menus");
|
||||
}
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
xco+=XIC;
|
||||
|
||||
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
|
||||
/* pull down menus */
|
||||
uiBlockSetEmboss(block, UI_EMBOSSP);
|
||||
|
||||
// xmax= GetButStringLength("View");
|
||||
// uiDefPulldownBut(block, time_viewmenu, NULL,
|
||||
// "View", xco, -2, xmax-3, 24, "");
|
||||
// xco+= xmax;
|
||||
}
|
||||
|
||||
/* always as last */
|
||||
sa->headbutlen= xco+2*XIC;
|
||||
|
||||
uiDrawBlock(block);
|
||||
}
|
||||
@@ -208,6 +208,7 @@ char *windowtype_pup(void)
|
||||
strcat(string, "|User Preferences %x7"); //213
|
||||
strcat(string, "|Outliner %x3"); //232
|
||||
strcat(string, "|Buttons Window %x4"); //251
|
||||
strcat(string, "|Node Editor %x16");
|
||||
|
||||
strcat(string, "|%l"); //254
|
||||
|
||||
@@ -1979,7 +1980,8 @@ void do_headerbuttons(short event)
|
||||
else if(event<700) do_sound_buttons(event);
|
||||
else if(event<750) do_action_buttons(event);
|
||||
else if(event<800) do_time_buttons(curarea, event);
|
||||
else if(event<900) do_nla_buttons(event);
|
||||
else if(event<850) do_nla_buttons(event);
|
||||
else if(event<900) do_node_buttons(curarea, event);
|
||||
else if(event>=REDRAWVIEW3D) allqueue(event, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,6 @@ uiBut *UIbuttip;
|
||||
/* ************* PROTOTYPES ***************** */
|
||||
|
||||
static void ui_set_but_val(uiBut *but, double value);
|
||||
static void ui_set_ftf_font(uiBlock *block);
|
||||
static void ui_do_but_tip(uiBut *buttip);
|
||||
|
||||
/* ****************************** */
|
||||
@@ -3552,14 +3551,14 @@ static int ui_mouse_motion_towards_block(uiBlock *block, uiEvent *uevent)
|
||||
}
|
||||
|
||||
|
||||
static void ui_set_ftf_font(uiBlock *block)
|
||||
static void ui_set_ftf_font(float aspect)
|
||||
{
|
||||
|
||||
#ifdef INTERNATIONAL
|
||||
if(block->aspect<1.15) {
|
||||
if(aspect<1.15) {
|
||||
FTF_SetFontSize('l');
|
||||
}
|
||||
else if(block->aspect<1.59) {
|
||||
else if(aspect<1.59) {
|
||||
FTF_SetFontSize('m');
|
||||
}
|
||||
else {
|
||||
@@ -3646,7 +3645,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
|
||||
}
|
||||
}
|
||||
|
||||
ui_set_ftf_font(block); // sets just a pointer in ftf lib... the button dont have ftf handles
|
||||
ui_set_ftf_font(block->aspect); // sets just a pointer in ftf lib... the button dont have ftf handles
|
||||
|
||||
// added this for panels in windows with buttons...
|
||||
// maybe speed optimize should require test
|
||||
@@ -4509,7 +4508,7 @@ static void ui_set_but_val(uiBut *but, double value)
|
||||
void uiSetCurFont(uiBlock *block, int index)
|
||||
{
|
||||
|
||||
ui_set_ftf_font(block);
|
||||
ui_set_ftf_font(block->aspect);
|
||||
|
||||
if(block->aspect<0.60) {
|
||||
block->curfont= UIfont[index].xl;
|
||||
@@ -4530,6 +4529,32 @@ void uiSetCurFont(uiBlock *block, int index)
|
||||
|
||||
}
|
||||
|
||||
/* called by node editor */
|
||||
void *uiSetCurFont_ext(float aspect)
|
||||
{
|
||||
void *curfont;
|
||||
|
||||
ui_set_ftf_font(aspect);
|
||||
|
||||
if(aspect<0.60) {
|
||||
curfont= UIfont[0].xl;
|
||||
}
|
||||
else if(aspect<1.15) {
|
||||
curfont= UIfont[0].large;
|
||||
}
|
||||
else if(aspect<1.59) {
|
||||
curfont= UIfont[0].medium;
|
||||
}
|
||||
else {
|
||||
curfont= UIfont[0].small;
|
||||
}
|
||||
|
||||
if(curfont==NULL) curfont= UIfont[0].large;
|
||||
if(curfont==NULL) curfont= UIfont[0].medium;
|
||||
|
||||
return curfont;
|
||||
}
|
||||
|
||||
void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small)
|
||||
{
|
||||
if(index>=UI_ARRAY) return;
|
||||
@@ -5649,12 +5674,12 @@ short pupmenu(char *instr)
|
||||
md= decompose_menu_string(instr);
|
||||
|
||||
/* size and location, title slightly bigger for bold */
|
||||
if(md->title) width= 2*strlen(md->title)+BIF_GetStringWidth(uiBlockGetCurFont(block), md->title, (U.transopts && USER_TR_BUTTONS));
|
||||
if(md->title) width= 2*strlen(md->title)+BIF_GetStringWidth(uiBlockGetCurFont(block), md->title, (U.transopts & USER_TR_BUTTONS));
|
||||
else width= 0;
|
||||
for(a=0; a<md->nitems; a++) {
|
||||
char *name= md->items[a].str;
|
||||
|
||||
xmax= BIF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, (U.transopts && USER_TR_BUTTONS));
|
||||
xmax= BIF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, (U.transopts & USER_TR_BUTTONS));
|
||||
if(xmax>width) width= xmax;
|
||||
|
||||
if( strcmp(name, "%l")==0) height+= PUP_LABELH;
|
||||
|
||||
@@ -95,9 +95,6 @@
|
||||
// globals
|
||||
extern float UIwinmat[4][4];
|
||||
|
||||
// local prototypes
|
||||
void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
|
||||
|
||||
|
||||
/* ************** safe rasterpos for pixmap alignment with pixels ************* */
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
@@ -4423,6 +4424,47 @@ static void init_timespace(ScrArea *sa)
|
||||
|
||||
}
|
||||
|
||||
/* ******************** SPACE: Time ********************** */
|
||||
|
||||
extern void drawnodespace(ScrArea *sa, void *spacedata);
|
||||
extern void winqreadnodespace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
|
||||
|
||||
static void init_nodespace(ScrArea *sa)
|
||||
{
|
||||
SpaceNode *snode;
|
||||
|
||||
snode= MEM_callocN(sizeof(SpaceNode), "init nodespace");
|
||||
BLI_addhead(&sa->spacedata, snode);
|
||||
|
||||
snode->spacetype= SPACE_NODE;
|
||||
snode->blockscale= 0.7;
|
||||
|
||||
snode->v2d.tot.xmin= -10.0;
|
||||
snode->v2d.tot.ymin= -10.0;
|
||||
snode->v2d.tot.xmax= (float)sa->winx + 10.0f;
|
||||
snode->v2d.tot.ymax= (float)sa->winy + 10.0f;
|
||||
|
||||
snode->v2d.cur.xmin= 0.0;
|
||||
snode->v2d.cur.ymin= 0.0;
|
||||
snode->v2d.cur.xmax= (float)sa->winx;
|
||||
snode->v2d.cur.ymax= (float)sa->winy;
|
||||
|
||||
snode->v2d.min[0]= 1.0;
|
||||
snode->v2d.min[1]= 1.0;
|
||||
|
||||
snode->v2d.max[0]= 32000.0f;
|
||||
snode->v2d.max[1]= 32000.0f;
|
||||
|
||||
snode->v2d.minzoom= 0.5f;
|
||||
snode->v2d.maxzoom= 1.21f;
|
||||
|
||||
snode->v2d.scroll= 0;
|
||||
snode->v2d.keepaspect= 1;
|
||||
snode->v2d.keepzoom= 1;
|
||||
snode->v2d.keeptot= 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ******************** SPACE: GENERAL ********************** */
|
||||
|
||||
@@ -4490,6 +4532,8 @@ void newspace(ScrArea *sa, int type)
|
||||
init_nlaspace(sa);
|
||||
else if(type==SPACE_TIME)
|
||||
init_timespace(sa);
|
||||
else if(type==SPACE_NODE)
|
||||
init_nodespace(sa);
|
||||
|
||||
sl= sa->spacedata.first;
|
||||
sl->area= sa;
|
||||
@@ -4584,6 +4628,11 @@ void freespacelist(ListBase *lb)
|
||||
else if(sl->spacetype==SPACE_SOUND) {
|
||||
free_soundspace((SpaceSound *)sl);
|
||||
}
|
||||
else if(sl->spacetype==SPACE_NODE) {
|
||||
SpaceNode *snode= (SpaceNode *)sl;
|
||||
if(snode->nodetree)
|
||||
nodeFreeTree(snode->nodetree);
|
||||
}
|
||||
}
|
||||
|
||||
BLI_freelistN(lb);
|
||||
@@ -4615,6 +4664,10 @@ void duplicatespacelist(ScrArea *newarea, ListBase *lb1, ListBase *lb2)
|
||||
}
|
||||
else if(sl->spacetype==SPACE_TEXT) {
|
||||
}
|
||||
else if(sl->spacetype==SPACE_NODE) {
|
||||
SpaceNode *snode= (SpaceNode *)sl;
|
||||
snode->nodetree= NULL;
|
||||
}
|
||||
/* __PINFAKE */
|
||||
/* else if(sfile->spacetype==SPACE_ACTION) {
|
||||
SpaceAction *sa= (SpaceAction *)sfile;
|
||||
@@ -4870,6 +4923,12 @@ void allqueue(unsigned short event, short val)
|
||||
scrarea_queue_winredraw(sa);
|
||||
}
|
||||
break;
|
||||
case REDRAWNODE:
|
||||
if(sa->spacetype==SPACE_NODE) {
|
||||
scrarea_queue_headredraw(sa);
|
||||
scrarea_queue_winredraw(sa);
|
||||
}
|
||||
break;
|
||||
case REDRAWANIM:
|
||||
if ELEM6(sa->spacetype, SPACE_IPO, SPACE_SOUND, SPACE_TIME, SPACE_NLA, SPACE_ACTION, SPACE_SEQ) {
|
||||
scrarea_queue_winredraw(sa);
|
||||
@@ -5177,3 +5236,15 @@ SpaceType *spacetime_get_type(void)
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
SpaceType *spacenode_get_type(void)
|
||||
{
|
||||
static SpaceType *st= NULL;
|
||||
|
||||
if (!st) {
|
||||
st= spacetype_new("Node");
|
||||
spacetype_set_winfuncs(st, drawnodespace, NULL, winqreadnodespace);
|
||||
}
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ static SpaceType *spacetype_from_area(ScrArea *area)
|
||||
case SPACE_SCRIPT: return spacescript_get_type();
|
||||
case SPACE_VIEW3D: return spaceview3d_get_type();
|
||||
case SPACE_TIME: return spacetime_get_type();
|
||||
case SPACE_NODE: return spacenode_get_type();
|
||||
default:
|
||||
newspace(area, SPACE_VIEW3D);
|
||||
return spaceview3d_get_type();
|
||||
|
||||
Reference in New Issue
Block a user