2003-10-15 19:23:54 +00:00
|
|
|
/**
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2003-10-15 19:23:54 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2003-10-15 19:23:54 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2003-10-15 19:23:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <io.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
#include "PIL_time.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BLI_arithb.h"
|
|
|
|
|
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
|
#include "DNA_vec_types.h"
|
|
|
|
|
|
|
|
|
|
#include "BKE_blender.h"
|
|
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
#include "BKE_global.h"
|
|
|
|
|
|
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
|
#include "BIF_graphics.h"
|
|
|
|
|
#include "BIF_keyval.h"
|
|
|
|
|
#include "BIF_mainqueue.h"
|
|
|
|
|
|
Compositing workflow upgrade;
You now can set a Preview panel in the Image window, to define a sub-rect
of an image to be processed. Works like the preview in 3D Window. Just
press SHIFT+P to get it activated. Very nice speedup!
This is how it works:
- The compositor still uses the scene image size (including % setting) for
Viewer or Composite output size
- If a preview exists, it calculates the cropped rect from its position
in the Image window, and stores that in the Scene render data
- On composite execute, it copies only this part from the 'generator nodes',
right now Images or Render Results. That makes the entire composite tree
only using small rects, so it will execute fast.
- Also the render window will only display the cropped rect, and on F12
only the cropped part is being executed
- On rendering in background mode, the cropping is ignored though.
Usability notes:
- translating or zooming view will automatically invoke a recalculation
- if you zoom in on details, the calculated rect will even become smaller
- only one Imagewindow can have this Preview Panel, to prevent conflicts of
what the cropped area should be. Compositing is on Scene level, not local
per image window. (Note; 3D Previews are local per window!)
- Closing the preview panel will invoke a full-size recalculation
- All passes/layers from rendering are nicely cropped, including Z and
vectors.
The work to make the compositor do cropping was simple, but getting the
Image window displaying correctly and get all events OK was a lot of work...
indeed, we need to refactor Image Window usage once. Sorry for making the
mess even bigger now. :) I've tried not to interfere with UV edit or Paint
though... only when you're in compositing mode the panel will work.
BUG fix:
3D Preview render didn't work when multiple layers were set in the current
scene.
2006-02-09 11:07:04 +00:00
|
|
|
#include "BIF_drawimage.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
#include "BIF_previewrender.h"
|
2003-10-15 19:23:54 +00:00
|
|
|
#include "BIF_screen.h"
|
|
|
|
|
#include "BIF_toolbox.h"
|
|
|
|
|
#include "BIF_mywindow.h"
|
|
|
|
|
#include "BIF_space.h"
|
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
#include "BIF_interface.h"
|
|
|
|
|
#include "BIF_butspace.h"
|
|
|
|
|
#include "BIF_language.h"
|
|
|
|
|
|
|
|
|
|
#include "BSE_view.h"
|
|
|
|
|
|
|
|
|
|
#include "mydevice.h"
|
|
|
|
|
#include "interface.h"
|
|
|
|
|
#include "blendef.h"
|
|
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
// globals
|
2003-10-15 19:23:54 +00:00
|
|
|
extern float UIwinmat[4][4];
|
|
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
/* --------- generic helper drawng calls ---------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define UI_RB_ALPHA 16
|
|
|
|
|
static int roundboxtype= 15;
|
|
|
|
|
|
|
|
|
|
void uiSetRoundBox(int type)
|
|
|
|
|
{
|
2007-04-22 17:14:23 +00:00
|
|
|
/* Not sure the roundbox function is the best place to change this
|
|
|
|
|
* if this is undone, its not that big a deal, only makes curves edges
|
|
|
|
|
* square for the */
|
|
|
|
|
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
|
|
|
|
|
roundboxtype= 0;
|
|
|
|
|
else
|
|
|
|
|
roundboxtype= type;
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
/* flags to set which corners will become rounded:
|
|
|
|
|
|
|
|
|
|
1------2
|
|
|
|
|
| |
|
|
|
|
|
8------4
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-31 13:43:18 +00:00
|
|
|
void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad)
|
2003-10-15 19:23:54 +00:00
|
|
|
{
|
|
|
|
|
float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
|
|
|
|
|
{0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
|
|
|
|
|
int a;
|
|
|
|
|
|
|
|
|
|
/* mult */
|
|
|
|
|
for(a=0; a<7; a++) {
|
|
|
|
|
vec[a][0]*= rad; vec[a][1]*= rad;
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-31 13:43:18 +00:00
|
|
|
glBegin(mode);
|
|
|
|
|
|
|
|
|
|
/* start with corner right-bottom */
|
|
|
|
|
if(roundboxtype & 4) {
|
|
|
|
|
glVertex2f( maxx-rad, miny);
|
|
|
|
|
for(a=0; a<7; a++) {
|
|
|
|
|
glVertex2f( maxx-rad+vec[a][0], miny+vec[a][1]);
|
|
|
|
|
}
|
|
|
|
|
glVertex2f( maxx, miny+rad);
|
|
|
|
|
}
|
|
|
|
|
else glVertex2f( maxx, miny);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-08-31 13:43:18 +00:00
|
|
|
/* corner right-top */
|
|
|
|
|
if(roundboxtype & 2) {
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( maxx, maxy-rad);
|
|
|
|
|
for(a=0; a<7; a++) {
|
|
|
|
|
glVertex2f( maxx-vec[a][1], maxy-rad+vec[a][0]);
|
|
|
|
|
}
|
|
|
|
|
glVertex2f( maxx-rad, maxy);
|
2004-08-31 13:43:18 +00:00
|
|
|
}
|
|
|
|
|
else glVertex2f( maxx, maxy);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-08-31 13:43:18 +00:00
|
|
|
/* corner left-top */
|
|
|
|
|
if(roundboxtype & 1) {
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( minx+rad, maxy);
|
|
|
|
|
for(a=0; a<7; a++) {
|
|
|
|
|
glVertex2f( minx+rad-vec[a][0], maxy-vec[a][1]);
|
|
|
|
|
}
|
|
|
|
|
glVertex2f( minx, maxy-rad);
|
|
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
else glVertex2f( minx, maxy);
|
|
|
|
|
|
|
|
|
|
/* corner left-bottom */
|
|
|
|
|
if(roundboxtype & 8) {
|
|
|
|
|
glVertex2f( minx, miny+rad);
|
|
|
|
|
for(a=0; a<7; a++) {
|
|
|
|
|
glVertex2f( minx+vec[a][1], miny+rad-vec[a][0]);
|
|
|
|
|
}
|
|
|
|
|
glVertex2f( minx+rad, miny);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
else glVertex2f( minx, miny);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
glEnd();
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-31 13:43:18 +00:00
|
|
|
static void round_box_shade_col(float *col1, float *col2, float fac)
|
|
|
|
|
{
|
|
|
|
|
float col[3];
|
|
|
|
|
|
|
|
|
|
col[0]= (fac*col1[0] + (1.0-fac)*col2[0]);
|
|
|
|
|
col[1]= (fac*col1[1] + (1.0-fac)*col2[1]);
|
|
|
|
|
col[2]= (fac*col1[2] + (1.0-fac)*col2[2]);
|
|
|
|
|
|
|
|
|
|
glColor3fv(col);
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-08-31 13:43:18 +00:00
|
|
|
/* linear horizontal shade within button or in outline */
|
2004-10-03 13:49:54 +00:00
|
|
|
void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown)
|
2003-10-15 19:23:54 +00:00
|
|
|
{
|
|
|
|
|
float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
|
|
|
|
|
{0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
|
2004-08-31 13:43:18 +00:00
|
|
|
float div= maxy-miny;
|
|
|
|
|
float coltop[3], coldown[3], color[4];
|
2003-10-15 19:23:54 +00:00
|
|
|
int a;
|
|
|
|
|
|
|
|
|
|
/* mult */
|
|
|
|
|
for(a=0; a<7; a++) {
|
|
|
|
|
vec[a][0]*= rad; vec[a][1]*= rad;
|
|
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
/* get current color, needs to be outside of glBegin/End */
|
|
|
|
|
glGetFloatv(GL_CURRENT_COLOR, color);
|
|
|
|
|
|
|
|
|
|
/* 'shade' defines strength of shading */
|
2004-10-03 13:49:54 +00:00
|
|
|
coltop[0]= color[0]+shadetop; if(coltop[0]>1.0) coltop[0]= 1.0;
|
|
|
|
|
coltop[1]= color[1]+shadetop; if(coltop[1]>1.0) coltop[1]= 1.0;
|
|
|
|
|
coltop[2]= color[2]+shadetop; if(coltop[2]>1.0) coltop[2]= 1.0;
|
|
|
|
|
coldown[0]= color[0]+shadedown; if(coldown[0]<0.0) coldown[0]= 0.0;
|
|
|
|
|
coldown[1]= color[1]+shadedown; if(coldown[1]<0.0) coldown[1]= 0.0;
|
|
|
|
|
coldown[2]= color[2]+shadedown; if(coldown[2]<0.0) coldown[2]= 0.0;
|
2004-08-31 13:43:18 +00:00
|
|
|
|
2007-04-22 17:14:23 +00:00
|
|
|
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(mode);
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* start with corner right-bottom */
|
|
|
|
|
if(roundboxtype & 4) {
|
2004-08-31 13:43:18 +00:00
|
|
|
|
|
|
|
|
round_box_shade_col(coltop, coldown, 0.0);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( maxx-rad, miny);
|
2004-08-31 13:43:18 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
for(a=0; a<7; a++) {
|
2004-08-31 13:43:18 +00:00
|
|
|
round_box_shade_col(coltop, coldown, vec[a][1]/div);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( maxx-rad+vec[a][0], miny+vec[a][1]);
|
|
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
|
|
|
|
|
round_box_shade_col(coltop, coldown, rad/div);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( maxx, miny+rad);
|
|
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
else {
|
|
|
|
|
round_box_shade_col(coltop, coldown, 0.0);
|
|
|
|
|
glVertex2f( maxx, miny);
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* corner right-top */
|
|
|
|
|
if(roundboxtype & 2) {
|
2004-08-31 13:43:18 +00:00
|
|
|
|
|
|
|
|
round_box_shade_col(coltop, coldown, (div-rad)/div);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( maxx, maxy-rad);
|
2004-08-31 13:43:18 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
for(a=0; a<7; a++) {
|
2004-08-31 13:43:18 +00:00
|
|
|
round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])/div);
|
2004-10-03 13:49:54 +00:00
|
|
|
glVertex2f( maxx-vec[a][1], maxy-rad+vec[a][0]);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
round_box_shade_col(coltop, coldown, 1.0);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( maxx-rad, maxy);
|
|
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
else {
|
|
|
|
|
round_box_shade_col(coltop, coldown, 1.0);
|
|
|
|
|
glVertex2f( maxx, maxy);
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* corner left-top */
|
|
|
|
|
if(roundboxtype & 1) {
|
2004-08-31 13:43:18 +00:00
|
|
|
|
|
|
|
|
round_box_shade_col(coltop, coldown, 1.0);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( minx+rad, maxy);
|
2004-08-31 13:43:18 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
for(a=0; a<7; a++) {
|
2004-08-31 13:43:18 +00:00
|
|
|
round_box_shade_col(coltop, coldown, (div-vec[a][1])/div);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( minx+rad-vec[a][0], maxy-vec[a][1]);
|
|
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
|
|
|
|
|
round_box_shade_col(coltop, coldown, (div-rad)/div);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( minx, maxy-rad);
|
|
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
else {
|
|
|
|
|
round_box_shade_col(coltop, coldown, 1.0);
|
|
|
|
|
glVertex2f( minx, maxy);
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* corner left-bottom */
|
|
|
|
|
if(roundboxtype & 8) {
|
2004-08-31 13:43:18 +00:00
|
|
|
|
|
|
|
|
round_box_shade_col(coltop, coldown, rad/div);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( minx, miny+rad);
|
2004-08-31 13:43:18 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
for(a=0; a<7; a++) {
|
2004-08-31 13:43:18 +00:00
|
|
|
round_box_shade_col(coltop, coldown, (rad-vec[a][1])/div);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( minx+vec[a][1], miny+rad-vec[a][0]);
|
|
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
|
|
|
|
|
round_box_shade_col(coltop, coldown, 0.0);
|
2003-10-15 19:23:54 +00:00
|
|
|
glVertex2f( minx+rad, miny);
|
|
|
|
|
}
|
2004-08-31 13:43:18 +00:00
|
|
|
else {
|
|
|
|
|
round_box_shade_col(coltop, coldown, 0.0);
|
|
|
|
|
glVertex2f( minx, miny);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glEnd();
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* only for headers */
|
|
|
|
|
static void gl_round_box_topshade(float minx, float miny, float maxx, float maxy, float rad)
|
|
|
|
|
{
|
|
|
|
|
float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
|
|
|
|
|
{0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
|
|
|
|
|
char col[7]= {140, 165, 195, 210, 230, 245, 255};
|
|
|
|
|
int a;
|
|
|
|
|
char alpha=255;
|
|
|
|
|
|
|
|
|
|
if(roundboxtype & UI_RB_ALPHA) alpha= 128;
|
|
|
|
|
|
|
|
|
|
/* mult */
|
|
|
|
|
for(a=0; a<7; a++) {
|
|
|
|
|
vec[a][0]*= rad; vec[a][1]*= rad;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* shades from grey->white->grey */
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-08-31 13:43:18 +00:00
|
|
|
if(roundboxtype & 3) {
|
|
|
|
|
/* corner right-top */
|
|
|
|
|
glColor4ub(140, 140, 140, alpha);
|
|
|
|
|
glVertex2f( maxx, maxy-rad);
|
|
|
|
|
for(a=0; a<7; a++) {
|
|
|
|
|
glColor4ub(col[a], col[a], col[a], alpha);
|
|
|
|
|
glVertex2f( maxx-vec[a][1], maxy-rad+vec[a][0]);
|
|
|
|
|
}
|
|
|
|
|
glColor4ub(225, 225, 225, alpha);
|
|
|
|
|
glVertex2f( maxx-rad, maxy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* corner left-top */
|
|
|
|
|
glVertex2f( minx+rad, maxy);
|
|
|
|
|
for(a=0; a<7; a++) {
|
|
|
|
|
glColor4ub(col[6-a], col[6-a], col[6-a], alpha);
|
|
|
|
|
glVertex2f( minx+rad-vec[a][0], maxy-vec[a][1]);
|
|
|
|
|
}
|
|
|
|
|
glVertex2f( minx, maxy-rad);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
glColor4ub(225, 225, 225, alpha);
|
|
|
|
|
glVertex2f( minx, maxy);
|
|
|
|
|
glVertex2f( maxx, maxy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glEnd();
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* for headers and floating panels */
|
2004-10-03 13:49:54 +00:00
|
|
|
void uiRoundBoxEmboss(float minx, float miny, float maxx, float maxy, float rad, int active)
|
2003-10-15 19:23:54 +00:00
|
|
|
{
|
|
|
|
|
float color[4];
|
|
|
|
|
|
|
|
|
|
if(roundboxtype & UI_RB_ALPHA) {
|
|
|
|
|
glGetFloatv(GL_CURRENT_COLOR, color);
|
|
|
|
|
color[3]= 0.5;
|
|
|
|
|
glColor4fv(color);
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* solid part */
|
2004-10-03 13:49:54 +00:00
|
|
|
//if(active)
|
|
|
|
|
// gl_round_box_shade(GL_POLYGON, minx, miny, maxx, maxy, rad, 0.10, -0.05);
|
|
|
|
|
// else
|
2007-04-22 17:14:23 +00:00
|
|
|
/* shading doesnt work for certain buttons yet (pulldown) need smarter buffer caching (ton) */
|
2004-08-31 13:43:18 +00:00
|
|
|
gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* set antialias line */
|
2007-04-22 17:14:23 +00:00
|
|
|
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
|
|
|
|
|
glEnable( GL_LINE_SMOOTH );
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2003-10-23 11:00:51 +00:00
|
|
|
/* top shade */
|
2003-10-15 19:23:54 +00:00
|
|
|
gl_round_box_topshade(minx+1, miny+1, maxx-1, maxy-1, rad);
|
|
|
|
|
|
2003-10-23 11:00:51 +00:00
|
|
|
/* total outline */
|
2004-12-14 18:18:31 +00:00
|
|
|
if(roundboxtype & UI_RB_ALPHA) glColor4ub(0,0,0, 128); else glColor4ub(0,0,0, 200);
|
2004-08-31 13:43:18 +00:00
|
|
|
gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
glDisable( GL_LINE_SMOOTH );
|
|
|
|
|
|
2003-10-23 11:00:51 +00:00
|
|
|
/* bottom shade for header down */
|
|
|
|
|
if((roundboxtype & 12)==12) {
|
|
|
|
|
glColor4ub(0,0,0, 80);
|
|
|
|
|
fdrawline(minx+rad-1.0, miny+1.0, maxx-rad+1.0, miny+1.0);
|
|
|
|
|
}
|
|
|
|
|
glDisable( GL_BLEND );
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* plain antialiased unfilled rectangle */
|
|
|
|
|
void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
|
|
|
|
|
{
|
|
|
|
|
float color[4];
|
|
|
|
|
|
|
|
|
|
if(roundboxtype & UI_RB_ALPHA) {
|
|
|
|
|
glGetFloatv(GL_CURRENT_COLOR, color);
|
|
|
|
|
color[3]= 0.5;
|
|
|
|
|
glColor4fv(color);
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* set antialias line */
|
2007-04-22 17:14:23 +00:00
|
|
|
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
|
|
|
|
|
glEnable( GL_LINE_SMOOTH );
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-08-31 13:43:18 +00:00
|
|
|
gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
glDisable( GL_BLEND );
|
|
|
|
|
glDisable( GL_LINE_SMOOTH );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* plain antialiased filled box */
|
|
|
|
|
void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
|
|
|
|
|
{
|
|
|
|
|
float color[4];
|
|
|
|
|
|
|
|
|
|
if(roundboxtype & UI_RB_ALPHA) {
|
|
|
|
|
glGetFloatv(GL_CURRENT_COLOR, color);
|
|
|
|
|
color[3]= 0.5;
|
|
|
|
|
glColor4fv(color);
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* solid part */
|
2004-08-31 13:43:18 +00:00
|
|
|
gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* set antialias line */
|
2007-04-22 17:14:23 +00:00
|
|
|
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
|
|
|
|
|
glEnable( GL_LINE_SMOOTH );
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-31 13:43:18 +00:00
|
|
|
gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
glDisable( GL_BLEND );
|
|
|
|
|
glDisable( GL_LINE_SMOOTH );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ************** panels ************* */
|
|
|
|
|
|
|
|
|
|
static void copy_panel_offset(Panel *pa, Panel *papar)
|
|
|
|
|
{
|
|
|
|
|
/* with respect to sizes... papar is parent */
|
|
|
|
|
|
|
|
|
|
pa->ofsx= papar->ofsx;
|
|
|
|
|
pa->ofsy= papar->ofsy + papar->sizey-pa->sizey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-10-16 00:17:24 +00:00
|
|
|
/* global... but will be NULLed after each 'newPanel' call */
|
2003-10-15 19:23:54 +00:00
|
|
|
static char *panel_tabbed=NULL, *group_tabbed=NULL;
|
|
|
|
|
|
|
|
|
|
void uiNewPanelTabbed(char *panelname, char *groupname)
|
|
|
|
|
{
|
|
|
|
|
panel_tabbed= panelname;
|
|
|
|
|
group_tabbed= groupname;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* another global... */
|
2003-10-16 00:17:24 +00:00
|
|
|
static int pnl_control= UI_PNL_TRANSP;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2003-10-16 00:17:24 +00:00
|
|
|
void uiPanelControl(int control)
|
2003-10-15 19:23:54 +00:00
|
|
|
{
|
2003-10-16 00:17:24 +00:00
|
|
|
pnl_control= control;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* another global... */
|
|
|
|
|
static int pnl_handler= 0;
|
|
|
|
|
|
|
|
|
|
void uiSetPanelHandler(int handler)
|
|
|
|
|
{
|
|
|
|
|
pnl_handler= handler;
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ofsx/ofsy only used for new panel definitions */
|
|
|
|
|
/* return 1 if visible (create buttons!) */
|
|
|
|
|
int uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey)
|
|
|
|
|
{
|
More node goodies!
First note; this is a WIP project, some commits might change things that
make formerly saved situations not to work identically... like now!
------ New Material integration ------
Until now, the Node system worked on top of the 'current' Material, just
like how the Material Layers worked. That's quite confusing in practice,
especially to see what Material is a Node, or what is the "base material"
Best solution is to completely separate the two. This has been implemented
as follows now;
- The confusing "Input" node has been removed.
- When choosing a Material in Blender, you can define this Material to be
either 'normal' (default) or be the root of a Node tree.
- If a Material is a Node tree, you have to add Nodes in the tree to see
something happen. An empty Node tree doesn't do anything (black).
- If a Material is a Node Tree, the 'data browse' menus show it with an
'N' mark before the name. The 'data block' buttons display it with the
suffix 'NT' (instead of 'MA').
- In a Node Tree, any Material can be inserted, including itself. Only in
that case the Material is being used itself for shading.
UI changes:
Added a new Panel "Links", which shows:
- where the Material is linked to (Object, Mesh, etc)
- if the Material is a NodeTree or not
- the actual active Material in the Tree
The "Node" Panel itself now only shows buttons from the other nodes, when
they are active.
Further the Material Nodes themselves allow browsing and renaming or adding
new Materials now too.
Second half of today's work was cleaning up selection when the Nodes
overlap... it was possible to drag links from invisible sockets, or click
headers for invisible nodes, etc. This because the mouse input code was
not checking for visibility yet.
Works now even for buttons. :)
2005-12-29 18:08:01 +00:00
|
|
|
Panel *pa;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* check if Panel exists, then use that one */
|
|
|
|
|
pa= sa->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if( strncmp(pa->panelname, panelname, UI_MAX_NAME_STR)==0) {
|
|
|
|
|
if( strncmp(pa->tabname, tabname, UI_MAX_NAME_STR)==0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-10 11:00:27 +00:00
|
|
|
if(pa) {
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
/* scale correction */
|
|
|
|
|
if(pa->control & UI_PNL_SCALE);
|
|
|
|
|
else {
|
2005-07-10 11:00:27 +00:00
|
|
|
pa->sizex= sizex;
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
if(pa->sizey != sizey) {
|
|
|
|
|
pa->ofsy+= (pa->sizey - sizey); // check uiNewPanelHeight()
|
|
|
|
|
pa->sizey= sizey;
|
|
|
|
|
}
|
2005-07-10 11:00:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* new panel */
|
|
|
|
|
pa= MEM_callocN(sizeof(Panel), "new panel");
|
|
|
|
|
BLI_addtail(&sa->panels, pa);
|
|
|
|
|
strncpy(pa->panelname, panelname, UI_MAX_NAME_STR);
|
|
|
|
|
strncpy(pa->tabname, tabname, UI_MAX_NAME_STR);
|
|
|
|
|
|
|
|
|
|
pa->ofsx= ofsx & ~(PNL_GRID-1);
|
|
|
|
|
pa->ofsy= ofsy & ~(PNL_GRID-1);
|
|
|
|
|
pa->sizex= sizex;
|
|
|
|
|
pa->sizey= sizey;
|
|
|
|
|
|
|
|
|
|
/* make new Panel tabbed? */
|
|
|
|
|
if(panel_tabbed && group_tabbed) {
|
|
|
|
|
Panel *papar;
|
|
|
|
|
for(papar= sa->panels.first; papar; papar= papar->next) {
|
|
|
|
|
if(papar->active && papar->paneltab==NULL) {
|
|
|
|
|
if( strncmp(panel_tabbed, papar->panelname, UI_MAX_NAME_STR)==0) {
|
|
|
|
|
if( strncmp(group_tabbed, papar->tabname, UI_MAX_NAME_STR)==0) {
|
|
|
|
|
pa->paneltab= papar;
|
|
|
|
|
copy_panel_offset(pa, papar);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
block->panel= pa;
|
|
|
|
|
block->handler= pnl_handler;
|
|
|
|
|
pa->active= 1;
|
|
|
|
|
pa->control= pnl_control;
|
|
|
|
|
|
2004-06-19 12:25:28 +00:00
|
|
|
/* global control over this feature; UI_PNL_TO_MOUSE only called for hotkey panels */
|
|
|
|
|
if(U.uiflag & USER_PANELPINNED);
|
|
|
|
|
else if(pnl_control & UI_PNL_TO_MOUSE) {
|
2003-10-16 00:17:24 +00:00
|
|
|
short mval[2];
|
|
|
|
|
|
|
|
|
|
Mat4CpyMat4(UIwinmat, block->winmat); // can be first event here
|
|
|
|
|
uiGetMouse(block->win, mval);
|
|
|
|
|
pa->ofsx= mval[0]-pa->sizex/2;
|
|
|
|
|
pa->ofsy= mval[1]-pa->sizey/2;
|
|
|
|
|
|
|
|
|
|
if(pa->flag & PNL_CLOSED) pa->flag &= ~PNL_CLOSED;
|
|
|
|
|
}
|
|
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
if(pnl_control & UI_PNL_UNSTOW) {
|
|
|
|
|
if(pa->flag & PNL_CLOSEDY) {
|
|
|
|
|
pa->flag &= ~PNL_CLOSED;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-10-16 00:17:24 +00:00
|
|
|
|
|
|
|
|
/* clear ugly globals */
|
2003-10-15 19:23:54 +00:00
|
|
|
panel_tabbed= group_tabbed= NULL;
|
2003-10-16 00:17:24 +00:00
|
|
|
pnl_handler= 0;
|
|
|
|
|
pnl_control= UI_PNL_TRANSP; // back to default
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
if(block->panel->paneltab) return 0;
|
|
|
|
|
if(block->panel->flag & PNL_CLOSED) return 0;
|
|
|
|
|
|
2007-03-27 09:13:18 +00:00
|
|
|
/* the 'return 0' above makes this to be in end. otherwise closes panels show wrong title */
|
|
|
|
|
pa->drawname[0]= 0;
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void uiFreePanels(ListBase *lb)
|
|
|
|
|
{
|
|
|
|
|
Panel *panel;
|
|
|
|
|
|
|
|
|
|
while( (panel= lb->first) ) {
|
|
|
|
|
BLI_remlink(lb, panel);
|
|
|
|
|
MEM_freeN(panel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void uiNewPanelHeight(uiBlock *block, int sizey)
|
|
|
|
|
{
|
|
|
|
|
if(sizey<64) sizey= 64;
|
|
|
|
|
|
|
|
|
|
if(block->panel) {
|
|
|
|
|
block->panel->ofsy+= (block->panel->sizey - sizey);
|
|
|
|
|
block->panel->sizey= sizey;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-16 20:55:11 +00:00
|
|
|
void uiNewPanelTitle(uiBlock *block, char *str)
|
|
|
|
|
{
|
|
|
|
|
if(block->panel)
|
|
|
|
|
BLI_strncpy(block->panel->drawname, str, UI_MAX_NAME_STR);
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
static int panel_has_tabs(Panel *panel)
|
|
|
|
|
{
|
|
|
|
|
Panel *pa= curarea->panels.first;
|
|
|
|
|
|
|
|
|
|
if(panel==NULL) return 0;
|
|
|
|
|
|
|
|
|
|
while(pa) {
|
2008-03-16 11:09:34 +00:00
|
|
|
if(pa->active && pa->paneltab==panel) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ui_scale_panel_block(uiBlock *block)
|
|
|
|
|
{
|
|
|
|
|
uiBut *but;
|
|
|
|
|
float facx= 1.0, facy= 1.0;
|
2007-04-04 13:18:41 +00:00
|
|
|
int centerx= 0, topy=0, tabsy=0;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
if(block->panel==NULL) return;
|
|
|
|
|
|
|
|
|
|
if(block->autofill) ui_autofill(block);
|
|
|
|
|
/* buttons min/max centered, offset calculated */
|
|
|
|
|
uiBoundsBlock(block, 0);
|
|
|
|
|
|
|
|
|
|
if( block->maxx-block->minx > block->panel->sizex - 2*PNL_SAFETY ) {
|
|
|
|
|
facx= (block->panel->sizex - (2*PNL_SAFETY))/( block->maxx-block->minx );
|
|
|
|
|
}
|
2007-04-04 13:18:41 +00:00
|
|
|
else centerx= (block->panel->sizex-( block->maxx-block->minx ) - 2*PNL_SAFETY)/2;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
// tabsy= PNL_HEADER*panel_has_tabs(block->panel);
|
|
|
|
|
if( (block->maxy-block->miny) > block->panel->sizey - 2*PNL_SAFETY - tabsy) {
|
|
|
|
|
facy= (block->panel->sizey - (2*PNL_SAFETY) - tabsy)/( block->maxy-block->miny );
|
|
|
|
|
}
|
|
|
|
|
else topy= (block->panel->sizey- 2*PNL_SAFETY - tabsy) - ( block->maxy-block->miny ) ;
|
|
|
|
|
|
|
|
|
|
but= block->buttons.first;
|
|
|
|
|
while(but) {
|
2007-04-04 13:18:41 +00:00
|
|
|
but->x1= PNL_SAFETY+centerx+ facx*(but->x1-block->minx);
|
2003-10-15 19:23:54 +00:00
|
|
|
but->y1= PNL_SAFETY+topy + facy*(but->y1-block->miny);
|
2007-04-04 13:18:41 +00:00
|
|
|
but->x2= PNL_SAFETY+centerx+ facx*(but->x2-block->minx);
|
2003-10-15 19:23:54 +00:00
|
|
|
but->y2= PNL_SAFETY+topy + facy*(but->y2-block->miny);
|
|
|
|
|
if(facx!=1.0) ui_check_but(but); /* for strlen */
|
|
|
|
|
but= but->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
block->maxx= block->panel->sizex;
|
|
|
|
|
block->maxy= block->panel->sizey;
|
|
|
|
|
block->minx= block->miny= 0.0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// for 'home' key
|
|
|
|
|
void uiSetPanel_view2d(ScrArea *sa)
|
|
|
|
|
{
|
|
|
|
|
Panel *pa;
|
|
|
|
|
float minx=10000, maxx= -10000, miny=10000, maxy= -10000;
|
|
|
|
|
int done=0;
|
|
|
|
|
|
|
|
|
|
pa= sa->panels.first;
|
|
|
|
|
while(pa) {
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
if(pa->active && pa->paneltab==NULL) {
|
2003-10-15 19:23:54 +00:00
|
|
|
done= 1;
|
|
|
|
|
if(pa->ofsx < minx) minx= pa->ofsx;
|
|
|
|
|
if(pa->ofsx+pa->sizex > maxx) maxx= pa->ofsx+pa->sizex;
|
|
|
|
|
if(pa->ofsy < miny) miny= pa->ofsy;
|
|
|
|
|
if(pa->ofsy+pa->sizey+PNL_HEADER > maxy) maxy= pa->ofsy+pa->sizey+PNL_HEADER;
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
if(done) {
|
|
|
|
|
G.v2d->tot.xmin= minx-PNL_DIST;
|
|
|
|
|
G.v2d->tot.xmax= maxx+PNL_DIST;
|
|
|
|
|
G.v2d->tot.ymin= miny-PNL_DIST;
|
|
|
|
|
G.v2d->tot.ymax= maxy+PNL_DIST;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2004-04-07 14:05:53 +00:00
|
|
|
uiBlock *block;
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
G.v2d->tot.xmin= 0;
|
|
|
|
|
G.v2d->tot.xmax= 1280;
|
|
|
|
|
G.v2d->tot.ymin= 0;
|
|
|
|
|
G.v2d->tot.ymax= 228;
|
2004-04-07 14:05:53 +00:00
|
|
|
|
|
|
|
|
/* no panels, but old 'loose' buttons, as in old logic editor */
|
|
|
|
|
for(block= sa->uiblocks.first; block; block= block->next) {
|
|
|
|
|
if(block->win==sa->win) {
|
|
|
|
|
if(block->minx < G.v2d->tot.xmin) G.v2d->tot.xmin= block->minx;
|
|
|
|
|
if(block->maxx > G.v2d->tot.xmax) G.v2d->tot.xmax= block->maxx;
|
|
|
|
|
if(block->miny < G.v2d->tot.ymin) G.v2d->tot.ymin= block->miny;
|
|
|
|
|
if(block->maxy > G.v2d->tot.ymax) G.v2d->tot.ymax= block->maxy;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// make sure the panels are not outside 'tot' area
|
|
|
|
|
void uiMatchPanel_view2d(ScrArea *sa)
|
|
|
|
|
{
|
|
|
|
|
Panel *pa;
|
2004-04-07 14:05:53 +00:00
|
|
|
int done=0;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
pa= sa->panels.first;
|
|
|
|
|
while(pa) {
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
if(pa->active && pa->paneltab==NULL) {
|
2004-04-07 14:05:53 +00:00
|
|
|
done= 1;
|
2003-10-15 19:23:54 +00:00
|
|
|
if(pa->ofsx < G.v2d->tot.xmin) G.v2d->tot.xmin= pa->ofsx;
|
|
|
|
|
if(pa->ofsx+pa->sizex > G.v2d->tot.xmax)
|
|
|
|
|
G.v2d->tot.xmax= pa->ofsx+pa->sizex;
|
|
|
|
|
if(pa->ofsy < G.v2d->tot.ymin) G.v2d->tot.ymin= pa->ofsy;
|
|
|
|
|
if(pa->ofsy+pa->sizey+PNL_HEADER > G.v2d->tot.ymax)
|
|
|
|
|
G.v2d->tot.ymax= pa->ofsy+pa->sizey+PNL_HEADER;
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
2004-04-07 14:05:53 +00:00
|
|
|
}
|
|
|
|
|
if(done==0) {
|
|
|
|
|
uiBlock *block;
|
|
|
|
|
/* no panels, but old 'loose' buttons, as in old logic editor */
|
|
|
|
|
for(block= sa->uiblocks.first; block; block= block->next) {
|
|
|
|
|
if(block->win==sa->win) {
|
|
|
|
|
if(block->minx < G.v2d->tot.xmin) G.v2d->tot.xmin= block->minx;
|
|
|
|
|
if(block->maxx > G.v2d->tot.xmax) G.v2d->tot.xmax= block->maxx;
|
|
|
|
|
if(block->miny < G.v2d->tot.ymin) G.v2d->tot.ymin= block->miny;
|
|
|
|
|
if(block->maxy > G.v2d->tot.ymax) G.v2d->tot.ymax= block->maxy;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-08-20 09:55:11 +00:00
|
|
|
/* extern used by previewrender */
|
2003-10-15 19:23:54 +00:00
|
|
|
void uiPanelPush(uiBlock *block)
|
|
|
|
|
{
|
|
|
|
|
glPushMatrix();
|
|
|
|
|
if(block->panel) {
|
|
|
|
|
glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0);
|
|
|
|
|
i_translate((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0, UIwinmat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void uiPanelPop(uiBlock *block)
|
|
|
|
|
{
|
|
|
|
|
glPopMatrix();
|
|
|
|
|
Mat4CpyMat4(UIwinmat, block->winmat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name)
|
|
|
|
|
{
|
|
|
|
|
uiBlock *block;
|
|
|
|
|
|
|
|
|
|
for(block= lb->first; block; block= block->next) {
|
|
|
|
|
if(block->panel && block->panel->active && block->panel->paneltab==NULL) {
|
|
|
|
|
if(block->panel->flag & PNL_CLOSED);
|
|
|
|
|
else if(strncmp(name, block->panel->panelname, UI_MAX_NAME_STR)==0) break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3)
|
|
|
|
|
{
|
|
|
|
|
// we draw twice, anti polygons not widely supported...
|
|
|
|
|
glBegin(GL_POLYGON);
|
|
|
|
|
glVertex2f(x1, y1);
|
|
|
|
|
glVertex2f(x2, y2);
|
|
|
|
|
glVertex2f(x3, y3);
|
|
|
|
|
glEnd();
|
2005-12-28 23:18:02 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
/* set antialias line */
|
|
|
|
|
glEnable( GL_LINE_SMOOTH );
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
|
glVertex2f(x1, y1);
|
|
|
|
|
glVertex2f(x2, y2);
|
|
|
|
|
glVertex2f(x3, y3);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
glDisable( GL_LINE_SMOOTH );
|
|
|
|
|
glDisable( GL_BLEND );
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-28 12:17:54 +00:00
|
|
|
/* triangle 'icon' for panel header */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
void ui_draw_tria_icon(float x, float y, float aspect, char dir)
|
2003-10-15 19:23:54 +00:00
|
|
|
{
|
|
|
|
|
if(dir=='h') {
|
2005-12-28 23:18:02 +00:00
|
|
|
ui_draw_anti_tria( x, y+1, x, y+10.0, x+8, y+6.25);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2005-12-28 23:18:02 +00:00
|
|
|
ui_draw_anti_tria( x-2, y+9, x+8-2, y+9, x+4.25-2, y+1);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
void ui_draw_anti_x(float x1, float y1, float x2, float y2)
|
2004-01-28 12:17:54 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/* set antialias line */
|
|
|
|
|
glEnable( GL_LINE_SMOOTH );
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
|
|
|
|
|
glLineWidth(2.0);
|
|
|
|
|
|
|
|
|
|
fdrawline(x1, y1, x2, y2);
|
|
|
|
|
fdrawline(x1, y2, x2, y1);
|
|
|
|
|
|
|
|
|
|
glLineWidth(1.0);
|
|
|
|
|
|
|
|
|
|
glDisable( GL_LINE_SMOOTH );
|
|
|
|
|
glDisable( GL_BLEND );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* x 'icon' for panel header */
|
|
|
|
|
static void ui_draw_x_icon(float x, float y)
|
|
|
|
|
{
|
|
|
|
|
BIF_ThemeColor(TH_TEXT_HI);
|
|
|
|
|
|
|
|
|
|
ui_draw_anti_x( x, y, x+9.375, y+9.375);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-17 16:17:21 +00:00
|
|
|
#if 0
|
2003-10-15 19:23:54 +00:00
|
|
|
static void ui_set_panel_pattern(char dir)
|
|
|
|
|
{
|
|
|
|
|
static int firsttime= 1;
|
|
|
|
|
static GLubyte path[4*32], patv[4*32];
|
|
|
|
|
int a,b,i=0;
|
|
|
|
|
|
|
|
|
|
if(firsttime) {
|
|
|
|
|
firsttime= 0;
|
|
|
|
|
for(a=0; a<128; a++) patv[a]= 0x33;
|
|
|
|
|
for(a=0; a<8; a++) {
|
|
|
|
|
for(b=0; b<4; b++) path[i++]= 0xff; /* 1 scanlines */
|
|
|
|
|
for(b=0; b<12; b++) path[i++]= 0x0; /* 3 lines */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
glEnable(GL_POLYGON_STIPPLE);
|
|
|
|
|
if(dir=='h') glPolygonStipple(path);
|
|
|
|
|
else glPolygonStipple(patv);
|
|
|
|
|
}
|
2003-10-17 16:17:21 +00:00
|
|
|
#endif
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
static char *ui_block_cut_str(uiBlock *block, char *str, short okwidth)
|
|
|
|
|
{
|
|
|
|
|
short width, ofs=strlen(str);
|
|
|
|
|
static char str1[128];
|
|
|
|
|
|
|
|
|
|
if(ofs>127) return str;
|
|
|
|
|
|
2004-01-13 14:50:45 +00:00
|
|
|
width= block->aspect*BIF_GetStringWidth(block->curfont, str, (U.transopts & USER_TR_BUTTONS));
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
if(width <= okwidth) return str;
|
|
|
|
|
strcpy(str1, str);
|
|
|
|
|
|
|
|
|
|
while(width > okwidth && ofs>0) {
|
|
|
|
|
ofs--;
|
|
|
|
|
str1[ofs]= 0;
|
|
|
|
|
|
|
|
|
|
width= block->aspect*BIF_GetStringWidth(block->curfont, str1, 0);
|
|
|
|
|
|
|
|
|
|
if(width < 10) break;
|
|
|
|
|
}
|
|
|
|
|
return str1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PNL_ICON 20
|
|
|
|
|
#define PNL_DRAGGER 20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void ui_draw_panel_header(uiBlock *block)
|
|
|
|
|
{
|
|
|
|
|
Panel *pa, *panel= block->panel;
|
|
|
|
|
float width;
|
2003-10-16 00:17:24 +00:00
|
|
|
int a, nr= 1, pnl_icons;
|
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
|
|
|
char *activename= panel->drawname[0]?panel->drawname:panel->panelname;
|
|
|
|
|
char *panelname, *str;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* count */
|
|
|
|
|
pa= curarea->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if(pa->active) {
|
|
|
|
|
if(pa->paneltab==panel) nr++;
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
2004-06-14 13:07:53 +00:00
|
|
|
|
2003-10-18 07:36:46 +00:00
|
|
|
pnl_icons= PNL_ICON+8;
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->control & UI_PNL_CLOSE) pnl_icons+= PNL_ICON;
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
if(nr==1) {
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
// full header
|
|
|
|
|
BIF_ThemeColorShade(TH_HEADER, -30);
|
|
|
|
|
uiSetRoundBox(3);
|
|
|
|
|
uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
|
|
|
|
|
|
2003-10-18 07:36:46 +00:00
|
|
|
/* active tab */
|
2004-06-14 13:07:53 +00:00
|
|
|
/* draw text label */
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColor(TH_TEXT_HI);
|
2005-08-20 09:55:11 +00:00
|
|
|
ui_rasterpos_safe(4.0f+block->minx+pnl_icons, block->maxy+5.0f, block->aspect);
|
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
|
|
|
BIF_DrawString(block->curfont, activename, (U.transopts & USER_TR_BUTTONS));
|
2003-10-15 19:23:54 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
// tabbed, full header brighter
|
2004-10-07 22:50:21 +00:00
|
|
|
//BIF_ThemeColorShade(TH_HEADER, 0);
|
|
|
|
|
//uiSetRoundBox(3);
|
|
|
|
|
//uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
a= 0;
|
2003-10-16 00:17:24 +00:00
|
|
|
width= (panel->sizex - 3 - pnl_icons - PNL_ICON)/nr;
|
2003-10-15 19:23:54 +00:00
|
|
|
pa= curarea->panels.first;
|
|
|
|
|
while(pa) {
|
2006-11-16 20:55:11 +00:00
|
|
|
panelname= pa->drawname[0]?pa->drawname:pa->panelname;
|
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
|
|
|
if(a == 0)
|
|
|
|
|
activename= panelname;
|
2006-11-16 20:55:11 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
if(pa->active==0);
|
|
|
|
|
else if(pa==panel) {
|
|
|
|
|
/* active tab */
|
2004-10-07 22:50:21 +00:00
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* draw the active tab */
|
2003-10-18 07:36:46 +00:00
|
|
|
uiSetRoundBox(3);
|
2004-10-07 22:50:21 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -3);
|
2003-10-18 07:36:46 +00:00
|
|
|
uiRoundBox(2+pnl_icons+a*width, panel->sizey-1, pnl_icons+(a+1)*width, panel->sizey+PNL_HEADER-3, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* draw the active text label */
|
2004-10-07 22:50:21 +00:00
|
|
|
BIF_ThemeColor(TH_TEXT);
|
2004-10-03 13:49:54 +00:00
|
|
|
ui_rasterpos_safe(16+pnl_icons+a*width, panel->sizey+4, block->aspect);
|
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
|
|
|
if(panelname != activename && strstr(panelname, activename) == panelname)
|
|
|
|
|
str= ui_block_cut_str(block, panelname+strlen(activename), (short)(width-10));
|
|
|
|
|
else
|
|
|
|
|
str= ui_block_cut_str(block, panelname, (short)(width-10));
|
2004-01-13 14:50:45 +00:00
|
|
|
BIF_DrawString(block->curfont, str, (U.transopts & USER_TR_BUTTONS));
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
a++;
|
|
|
|
|
}
|
|
|
|
|
else if(pa->paneltab==panel) {
|
2004-06-14 13:07:53 +00:00
|
|
|
/* draw an inactive tab */
|
|
|
|
|
uiSetRoundBox(3);
|
2004-10-07 22:50:21 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -60);
|
2003-10-18 07:36:46 +00:00
|
|
|
uiRoundBox(2+pnl_icons+a*width, panel->sizey, pnl_icons+(a+1)*width, panel->sizey+PNL_HEADER-3, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* draw an inactive tab label */
|
2004-10-07 22:50:21 +00:00
|
|
|
BIF_ThemeColorShade(TH_TEXT_HI, -40);
|
2004-10-03 13:49:54 +00:00
|
|
|
ui_rasterpos_safe(16+pnl_icons+a*width, panel->sizey+4, block->aspect);
|
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
|
|
|
if(panelname != activename && strstr(panelname, activename) == panelname)
|
|
|
|
|
str= ui_block_cut_str(block, panelname+strlen(activename), (short)(width-10));
|
|
|
|
|
else
|
|
|
|
|
str= ui_block_cut_str(block, panelname, (short)(width-10));
|
2004-01-13 14:50:45 +00:00
|
|
|
BIF_DrawString(block->curfont, str, (U.transopts & USER_TR_BUTTONS));
|
2003-10-18 07:36:46 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
a++;
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// dragger
|
2003-10-18 07:36:46 +00:00
|
|
|
/*
|
2003-10-15 19:23:54 +00:00
|
|
|
uiSetRoundBox(15);
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -70);
|
2003-10-15 19:23:54 +00:00
|
|
|
uiRoundBox(panel->sizex-PNL_ICON+5, panel->sizey+5, panel->sizex-5, panel->sizey+PNL_HEADER-5, 5);
|
2003-10-18 07:36:46 +00:00
|
|
|
*/
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
static void ui_draw_panel_scalewidget(uiBlock *block)
|
|
|
|
|
{
|
|
|
|
|
float xmin, xmax, dx;
|
|
|
|
|
float ymin, ymax, dy;
|
|
|
|
|
|
|
|
|
|
xmin= block->maxx-PNL_HEADER+2;
|
|
|
|
|
xmax= block->maxx-3;
|
|
|
|
|
ymin= block->miny+3;
|
|
|
|
|
ymax= block->miny+PNL_HEADER-2;
|
|
|
|
|
|
|
|
|
|
dx= 0.5f*(xmax-xmin);
|
|
|
|
|
dy= 0.5f*(ymax-ymin);
|
|
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glColor4ub(255, 255, 255, 50);
|
|
|
|
|
fdrawline(xmin, ymin, xmax, ymax);
|
|
|
|
|
fdrawline(xmin+dx, ymin, xmax, ymax-dy);
|
|
|
|
|
|
|
|
|
|
glColor4ub(0, 0, 0, 50);
|
|
|
|
|
fdrawline(xmin, ymin+block->aspect, xmax, ymax+block->aspect);
|
|
|
|
|
fdrawline(xmin+dx, ymin+block->aspect, xmax, ymax-dy+block->aspect);
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
void ui_draw_panel(uiBlock *block)
|
|
|
|
|
{
|
2003-10-16 00:17:24 +00:00
|
|
|
Panel *panel= block->panel;
|
2003-12-24 11:44:57 +00:00
|
|
|
int ofsx;
|
2006-11-16 20:55:11 +00:00
|
|
|
char *panelname= panel->drawname[0]?panel->drawname:panel->panelname;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->paneltab) return;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2005-08-20 09:55:11 +00:00
|
|
|
/* if the panel is minimized vertically:
|
2004-06-14 13:07:53 +00:00
|
|
|
* (------)
|
|
|
|
|
*/
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->flag & PNL_CLOSEDY) {
|
2004-06-14 13:07:53 +00:00
|
|
|
/* draw a little rounded box, the size of the header */
|
2003-10-15 19:23:54 +00:00
|
|
|
uiSetRoundBox(15);
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -30);
|
2004-06-14 13:07:53 +00:00
|
|
|
uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* title */
|
2003-10-18 12:02:03 +00:00
|
|
|
ofsx= PNL_ICON+8;
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->control & UI_PNL_CLOSE) ofsx+= PNL_ICON;
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColor(TH_TEXT_HI);
|
2004-10-03 13:49:54 +00:00
|
|
|
ui_rasterpos_safe(4+block->minx+ofsx, block->maxy+5, block->aspect);
|
2006-11-16 20:55:11 +00:00
|
|
|
BIF_DrawString(block->curfont, panelname, (U.transopts & USER_TR_BUTTONS));
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* border */
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->flag & PNL_SELECT) {
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -120);
|
2004-06-14 13:07:53 +00:00
|
|
|
uiRoundRect(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
2004-06-14 13:07:53 +00:00
|
|
|
/* if it's being overlapped by a panel being dragged */
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->flag & PNL_OVERLAP) {
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColor(TH_TEXT_HI);
|
2004-06-14 13:07:53 +00:00
|
|
|
uiRoundRect(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2005-08-20 09:55:11 +00:00
|
|
|
/* if the panel is minimized horizontally:
|
2004-06-14 13:07:53 +00:00
|
|
|
* /-\
|
|
|
|
|
* |
|
|
|
|
|
* |
|
|
|
|
|
* |
|
|
|
|
|
* \_/
|
|
|
|
|
*/
|
2003-10-16 00:17:24 +00:00
|
|
|
else if(panel->flag & PNL_CLOSEDX) {
|
2003-10-15 19:23:54 +00:00
|
|
|
char str[4];
|
|
|
|
|
int a, end, ofs;
|
|
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* draw a little rounded box, the size of the header, rotated 90 deg */
|
2003-10-15 19:23:54 +00:00
|
|
|
uiSetRoundBox(15);
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -30);
|
2004-06-14 13:07:53 +00:00
|
|
|
uiRoundBox(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* title, only the initial character for now */
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColor(TH_TEXT_HI);
|
2003-10-15 19:23:54 +00:00
|
|
|
str[1]= 0;
|
2006-11-16 20:55:11 +00:00
|
|
|
end= strlen(panelname);
|
2003-10-15 19:23:54 +00:00
|
|
|
ofs= 20;
|
|
|
|
|
for(a=0; a<end; a++) {
|
2006-11-16 20:55:11 +00:00
|
|
|
str[0]= panelname[a];
|
2003-10-15 19:23:54 +00:00
|
|
|
if( isupper(str[0]) ) {
|
2004-10-03 13:49:54 +00:00
|
|
|
ui_rasterpos_safe(block->minx+5, block->maxy-ofs, block->aspect);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
BIF_DrawString(block->curfont, str, 0);
|
2003-10-15 19:23:54 +00:00
|
|
|
ofs+= 15;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* border */
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->flag & PNL_SELECT) {
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -120);
|
2004-06-14 13:07:53 +00:00
|
|
|
uiRoundRect(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->flag & PNL_OVERLAP) {
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColor(TH_TEXT_HI);
|
2004-06-14 13:07:53 +00:00
|
|
|
uiRoundRect(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2004-06-14 13:07:53 +00:00
|
|
|
/* an open panel */
|
2003-10-15 19:23:54 +00:00
|
|
|
else {
|
2004-06-30 21:59:12 +00:00
|
|
|
/* all panels now... */
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->control & UI_PNL_SOLID) {
|
2003-10-21 07:02:04 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -30);
|
2004-06-14 13:07:53 +00:00
|
|
|
|
|
|
|
|
uiSetRoundBox(3);
|
|
|
|
|
uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
glEnable(GL_BLEND);
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColor4(TH_PANEL);
|
Compositing workflow upgrade;
You now can set a Preview panel in the Image window, to define a sub-rect
of an image to be processed. Works like the preview in 3D Window. Just
press SHIFT+P to get it activated. Very nice speedup!
This is how it works:
- The compositor still uses the scene image size (including % setting) for
Viewer or Composite output size
- If a preview exists, it calculates the cropped rect from its position
in the Image window, and stores that in the Scene render data
- On composite execute, it copies only this part from the 'generator nodes',
right now Images or Render Results. That makes the entire composite tree
only using small rects, so it will execute fast.
- Also the render window will only display the cropped rect, and on F12
only the cropped part is being executed
- On rendering in background mode, the cropping is ignored though.
Usability notes:
- translating or zooming view will automatically invoke a recalculation
- if you zoom in on details, the calculated rect will even become smaller
- only one Imagewindow can have this Preview Panel, to prevent conflicts of
what the cropped area should be. Compositing is on Scene level, not local
per image window. (Note; 3D Previews are local per window!)
- Closing the preview panel will invoke a full-size recalculation
- All passes/layers from rendering are nicely cropped, including Z and
vectors.
The work to make the compositor do cropping was simple, but getting the
Image window displaying correctly and get all events OK was a lot of work...
indeed, we need to refactor Image Window usage once. Sorry for making the
mess even bigger now. :) I've tried not to interfere with UV edit or Paint
though... only when you're in compositing mode the panel will work.
BUG fix:
3D Preview render didn't work when multiple layers were set in the current
scene.
2006-02-09 11:07:04 +00:00
|
|
|
|
2004-06-30 21:59:12 +00:00
|
|
|
uiSetRoundBox(12);
|
Compositing workflow upgrade;
You now can set a Preview panel in the Image window, to define a sub-rect
of an image to be processed. Works like the preview in 3D Window. Just
press SHIFT+P to get it activated. Very nice speedup!
This is how it works:
- The compositor still uses the scene image size (including % setting) for
Viewer or Composite output size
- If a preview exists, it calculates the cropped rect from its position
in the Image window, and stores that in the Scene render data
- On composite execute, it copies only this part from the 'generator nodes',
right now Images or Render Results. That makes the entire composite tree
only using small rects, so it will execute fast.
- Also the render window will only display the cropped rect, and on F12
only the cropped part is being executed
- On rendering in background mode, the cropping is ignored though.
Usability notes:
- translating or zooming view will automatically invoke a recalculation
- if you zoom in on details, the calculated rect will even become smaller
- only one Imagewindow can have this Preview Panel, to prevent conflicts of
what the cropped area should be. Compositing is on Scene level, not local
per image window. (Note; 3D Previews are local per window!)
- Closing the preview panel will invoke a full-size recalculation
- All passes/layers from rendering are nicely cropped, including Z and
vectors.
The work to make the compositor do cropping was simple, but getting the
Image window displaying correctly and get all events OK was a lot of work...
indeed, we need to refactor Image Window usage once. Sorry for making the
mess even bigger now. :) I've tried not to interfere with UV edit or Paint
though... only when you're in compositing mode the panel will work.
BUG fix:
3D Preview render didn't work when multiple layers were set in the current
scene.
2006-02-09 11:07:04 +00:00
|
|
|
/* bad code... but its late :) */
|
|
|
|
|
if(strcmp(block->name, "image_panel_preview")==0)
|
|
|
|
|
uiRoundRect(block->minx, block->miny, block->maxx, block->maxy, 8);
|
|
|
|
|
else
|
|
|
|
|
uiRoundBox(block->minx, block->miny, block->maxx, block->maxy, 8);
|
2004-06-14 13:07:53 +00:00
|
|
|
|
|
|
|
|
// glRectf(block->minx, block->miny, block->maxx, block->maxy);
|
|
|
|
|
|
|
|
|
|
/* shadow */
|
|
|
|
|
/*
|
2004-01-28 12:17:54 +00:00
|
|
|
glColor4ub(0, 0, 0, 40);
|
|
|
|
|
|
|
|
|
|
fdrawline(block->minx+2, block->miny-1, block->maxx+1, block->miny-1);
|
|
|
|
|
fdrawline(block->maxx+1, block->miny-1, block->maxx+1, block->maxy+7);
|
|
|
|
|
|
|
|
|
|
glColor4ub(0, 0, 0, 10);
|
|
|
|
|
|
|
|
|
|
fdrawline(block->minx+3, block->miny-2, block->maxx+2, block->miny-2);
|
|
|
|
|
fdrawline(block->maxx+2, block->miny-2, block->maxx+2, block->maxy+6);
|
2004-06-14 13:07:53 +00:00
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
}
|
2004-06-14 13:07:53 +00:00
|
|
|
/* floating panel */
|
2003-10-16 00:17:24 +00:00
|
|
|
else if(panel->control & UI_PNL_TRANSP) {
|
2004-10-07 22:50:21 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -30);
|
|
|
|
|
uiSetRoundBox(3);
|
|
|
|
|
uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
|
2003-10-18 07:36:46 +00:00
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColor4(TH_PANEL);
|
2003-10-18 07:36:46 +00:00
|
|
|
glRectf(block->minx, block->miny, block->maxx, block->maxy);
|
2004-01-28 12:17:54 +00:00
|
|
|
|
2003-10-18 07:36:46 +00:00
|
|
|
glDisable(GL_BLEND);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* draw the title, tabs, etc in the header */
|
2003-10-15 19:23:54 +00:00
|
|
|
ui_draw_panel_header(block);
|
|
|
|
|
|
2004-06-14 13:07:53 +00:00
|
|
|
/* in some occasions, draw a border */
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->flag & PNL_SELECT) {
|
2004-06-14 13:07:53 +00:00
|
|
|
if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15);
|
|
|
|
|
else uiSetRoundBox(3);
|
|
|
|
|
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColorShade(TH_HEADER, -120);
|
2004-06-14 13:07:53 +00:00
|
|
|
uiRoundRect(block->minx, block->miny, block->maxx, block->maxy+PNL_HEADER, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->flag & PNL_OVERLAP) {
|
2004-06-14 13:07:53 +00:00
|
|
|
if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15);
|
|
|
|
|
else uiSetRoundBox(3);
|
|
|
|
|
|
2003-10-19 09:19:58 +00:00
|
|
|
BIF_ThemeColor(TH_TEXT_HI);
|
2004-06-14 13:07:53 +00:00
|
|
|
uiRoundRect(block->minx, block->miny, block->maxx, block->maxy+PNL_HEADER, 8);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
if(panel->control & UI_PNL_SCALE)
|
|
|
|
|
ui_draw_panel_scalewidget(block);
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
/* and a soft shadow-line for now */
|
2004-06-14 13:07:53 +00:00
|
|
|
/*
|
2003-10-15 19:23:54 +00:00
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
glColor4ub(0, 0, 0, 50);
|
|
|
|
|
fdrawline(block->maxx, block->miny, block->maxx, block->maxy+PNL_HEADER/2);
|
|
|
|
|
fdrawline(block->minx, block->miny, block->maxx, block->miny);
|
|
|
|
|
glDisable(GL_BLEND);
|
2004-06-14 13:07:53 +00:00
|
|
|
*/
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
}
|
2003-10-16 00:17:24 +00:00
|
|
|
|
|
|
|
|
/* draw optional close icon */
|
|
|
|
|
|
2003-10-18 07:36:46 +00:00
|
|
|
ofsx= 6;
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->control & UI_PNL_CLOSE) {
|
2004-01-28 12:17:54 +00:00
|
|
|
|
|
|
|
|
ui_draw_x_icon(block->minx+2+ofsx, block->maxy+5);
|
2003-10-18 07:36:46 +00:00
|
|
|
ofsx= 22;
|
2003-10-16 00:17:24 +00:00
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
2003-10-16 00:17:24 +00:00
|
|
|
/* draw collapse icon */
|
|
|
|
|
|
2005-12-28 21:50:06 +00:00
|
|
|
BIF_ThemeColor(TH_TEXT_HI);
|
|
|
|
|
|
2003-10-16 00:17:24 +00:00
|
|
|
if(panel->flag & PNL_CLOSEDY)
|
|
|
|
|
ui_draw_tria_icon(block->minx+6+ofsx, block->maxy+5, block->aspect, 'h');
|
|
|
|
|
else if(panel->flag & PNL_CLOSEDX)
|
2003-10-18 07:36:46 +00:00
|
|
|
ui_draw_tria_icon(block->minx+7, block->maxy+2, block->aspect, 'h');
|
2003-10-15 19:23:54 +00:00
|
|
|
else
|
2003-10-16 00:17:24 +00:00
|
|
|
ui_draw_tria_icon(block->minx+6+ofsx, block->maxy+5, block->aspect, 'v');
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ui_redraw_select_panel(ScrArea *sa)
|
|
|
|
|
{
|
|
|
|
|
/* only for beauty, make sure the panel thats moved is on top */
|
|
|
|
|
/* better solution later? */
|
|
|
|
|
uiBlock *block;
|
|
|
|
|
|
|
|
|
|
for(block= sa->uiblocks.first; block; block= block->next) {
|
|
|
|
|
if(block->panel && (block->panel->flag & PNL_SELECT)) {
|
|
|
|
|
uiDrawBlock(block);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ------------ panel alignment ---------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* this function is needed because uiBlock and Panel itself dont
|
|
|
|
|
change sizey or location when closed */
|
|
|
|
|
static int get_panel_real_ofsy(Panel *pa)
|
|
|
|
|
{
|
|
|
|
|
if(pa->flag & PNL_CLOSEDY) return pa->ofsy+pa->sizey;
|
|
|
|
|
else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDY)) return pa->ofsy+pa->sizey;
|
|
|
|
|
else return pa->ofsy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int get_panel_real_ofsx(Panel *pa)
|
|
|
|
|
{
|
|
|
|
|
if(pa->flag & PNL_CLOSEDX) return pa->ofsx+PNL_HEADER;
|
|
|
|
|
else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+PNL_HEADER;
|
|
|
|
|
else return pa->ofsx+pa->sizex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct PanelSort {
|
|
|
|
|
Panel *pa, *orig;
|
|
|
|
|
} PanelSort;
|
|
|
|
|
|
2004-12-01 12:39:14 +00:00
|
|
|
/* note about sorting;
|
|
|
|
|
the sortcounter has a lower value for new panels being added.
|
|
|
|
|
however, that only works to insert a single panel, when more new panels get
|
|
|
|
|
added the coordinates of existing panels and the previously stored to-be-insterted
|
|
|
|
|
panels do not match for sorting */
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
static int find_leftmost_panel(const void *a1, const void *a2)
|
|
|
|
|
{
|
|
|
|
|
const PanelSort *ps1=a1, *ps2=a2;
|
|
|
|
|
|
|
|
|
|
if( ps1->pa->ofsx > ps2->pa->ofsx) return 1;
|
|
|
|
|
else if( ps1->pa->ofsx < ps2->pa->ofsx) return -1;
|
2004-12-01 12:39:14 +00:00
|
|
|
else if( ps1->pa->sortcounter > ps2->pa->sortcounter) return 1;
|
|
|
|
|
else if( ps1->pa->sortcounter < ps2->pa->sortcounter) return -1;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int find_highest_panel(const void *a1, const void *a2)
|
|
|
|
|
{
|
|
|
|
|
const PanelSort *ps1=a1, *ps2=a2;
|
|
|
|
|
|
|
|
|
|
if( ps1->pa->ofsy < ps2->pa->ofsy) return 1;
|
|
|
|
|
else if( ps1->pa->ofsy > ps2->pa->ofsy) return -1;
|
2004-12-01 12:39:14 +00:00
|
|
|
else if( ps1->pa->sortcounter > ps2->pa->sortcounter) return 1;
|
|
|
|
|
else if( ps1->pa->sortcounter < ps2->pa->sortcounter) return -1;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* this doesnt draw */
|
|
|
|
|
/* returns 1 when it did something */
|
|
|
|
|
int uiAlignPanelStep(ScrArea *sa, float fac)
|
|
|
|
|
{
|
|
|
|
|
SpaceButs *sbuts= sa->spacedata.first;
|
|
|
|
|
Panel *pa;
|
|
|
|
|
PanelSort *ps, *panelsort, *psnext;
|
2004-12-01 12:39:14 +00:00
|
|
|
static int sortcounter= 0;
|
2003-10-15 19:23:54 +00:00
|
|
|
int a, tot=0, done;
|
|
|
|
|
|
|
|
|
|
if(sa->spacetype!=SPACE_BUTS) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* count active, not tabbed Panels */
|
|
|
|
|
for(pa= sa->panels.first; pa; pa= pa->next) {
|
|
|
|
|
if(pa->active && pa->paneltab==NULL) tot++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(tot==0) return 0;
|
|
|
|
|
|
|
|
|
|
/* extra; change close direction? */
|
|
|
|
|
for(pa= sa->panels.first; pa; pa= pa->next) {
|
|
|
|
|
if(pa->active && pa->paneltab==NULL) {
|
|
|
|
|
if( (pa->flag & PNL_CLOSEDX) && (sbuts->align==BUT_VERTICAL) )
|
|
|
|
|
pa->flag ^= PNL_CLOSED;
|
|
|
|
|
|
|
|
|
|
else if( (pa->flag & PNL_CLOSEDY) && (sbuts->align==BUT_HORIZONTAL) )
|
|
|
|
|
pa->flag ^= PNL_CLOSED;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
panelsort= MEM_callocN( tot*sizeof(PanelSort), "panelsort");
|
|
|
|
|
|
|
|
|
|
/* fill panelsort array */
|
|
|
|
|
ps= panelsort;
|
|
|
|
|
for(pa= sa->panels.first; pa; pa= pa->next) {
|
|
|
|
|
if(pa->active && pa->paneltab==NULL) {
|
|
|
|
|
ps->pa= MEM_dupallocN(pa);
|
|
|
|
|
ps->orig= pa;
|
|
|
|
|
ps++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(sbuts->align==BUT_VERTICAL)
|
|
|
|
|
qsort(panelsort, tot, sizeof(PanelSort), find_highest_panel);
|
|
|
|
|
else
|
|
|
|
|
qsort(panelsort, tot, sizeof(PanelSort), find_leftmost_panel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
|
|
|
|
|
ps= panelsort;
|
|
|
|
|
ps->pa->ofsx= 0;
|
|
|
|
|
ps->pa->ofsy= 0;
|
|
|
|
|
|
|
|
|
|
for(a=0 ; a<tot-1; a++, ps++) {
|
|
|
|
|
psnext= ps+1;
|
More node goodies!
First note; this is a WIP project, some commits might change things that
make formerly saved situations not to work identically... like now!
------ New Material integration ------
Until now, the Node system worked on top of the 'current' Material, just
like how the Material Layers worked. That's quite confusing in practice,
especially to see what Material is a Node, or what is the "base material"
Best solution is to completely separate the two. This has been implemented
as follows now;
- The confusing "Input" node has been removed.
- When choosing a Material in Blender, you can define this Material to be
either 'normal' (default) or be the root of a Node tree.
- If a Material is a Node tree, you have to add Nodes in the tree to see
something happen. An empty Node tree doesn't do anything (black).
- If a Material is a Node Tree, the 'data browse' menus show it with an
'N' mark before the name. The 'data block' buttons display it with the
suffix 'NT' (instead of 'MA').
- In a Node Tree, any Material can be inserted, including itself. Only in
that case the Material is being used itself for shading.
UI changes:
Added a new Panel "Links", which shows:
- where the Material is linked to (Object, Mesh, etc)
- if the Material is a NodeTree or not
- the actual active Material in the Tree
The "Node" Panel itself now only shows buttons from the other nodes, when
they are active.
Further the Material Nodes themselves allow browsing and renaming or adding
new Materials now too.
Second half of today's work was cleaning up selection when the Nodes
overlap... it was possible to drag links from invisible sockets, or click
headers for invisible nodes, etc. This because the mouse input code was
not checking for visibility yet.
Works now even for buttons. :)
2005-12-29 18:08:01 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
if(sbuts->align==BUT_VERTICAL) {
|
|
|
|
|
psnext->pa->ofsx = ps->pa->ofsx;
|
|
|
|
|
psnext->pa->ofsy = get_panel_real_ofsy(ps->pa) - psnext->pa->sizey-PNL_HEADER-PNL_DIST;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
psnext->pa->ofsx = get_panel_real_ofsx(ps->pa)+PNL_DIST;
|
2003-10-19 09:19:58 +00:00
|
|
|
psnext->pa->ofsy = ps->pa->ofsy + ps->pa->sizey - psnext->pa->sizey;
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* we interpolate */
|
|
|
|
|
done= 0;
|
|
|
|
|
ps= panelsort;
|
|
|
|
|
for(a=0; a<tot; a++, ps++) {
|
|
|
|
|
if( (ps->pa->flag & PNL_SELECT)==0) {
|
|
|
|
|
if( (ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
|
|
|
|
|
ps->orig->ofsx= floor(0.5 + fac*ps->pa->ofsx + (1.0-fac)*ps->orig->ofsx);
|
|
|
|
|
ps->orig->ofsy= floor(0.5 + fac*ps->pa->ofsy + (1.0-fac)*ps->orig->ofsy);
|
|
|
|
|
done= 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* copy locations to tabs */
|
|
|
|
|
for(pa= sa->panels.first; pa; pa= pa->next) {
|
|
|
|
|
if(pa->paneltab && pa->active) {
|
|
|
|
|
copy_panel_offset(pa, pa->paneltab);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-01 12:39:14 +00:00
|
|
|
/* set counter, used for sorting with newly added panels */
|
|
|
|
|
sortcounter++;
|
|
|
|
|
for(pa= sa->panels.first; pa; pa= pa->next) {
|
|
|
|
|
if(pa->active) pa->sortcounter= sortcounter;
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
/* free panelsort array */
|
|
|
|
|
ps= panelsort;
|
|
|
|
|
for(a=0; a<tot; a++, ps++) {
|
|
|
|
|
MEM_freeN(ps->pa);
|
|
|
|
|
}
|
|
|
|
|
MEM_freeN(panelsort);
|
|
|
|
|
|
|
|
|
|
return done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void ui_animate_panels(ScrArea *sa)
|
|
|
|
|
{
|
|
|
|
|
double time=0, ltime;
|
|
|
|
|
float result= 0.0, fac= 0.2;
|
|
|
|
|
|
|
|
|
|
ltime = PIL_check_seconds_timer();
|
|
|
|
|
|
|
|
|
|
/* for max 1 second, interpolate positions */
|
|
|
|
|
while(TRUE) {
|
|
|
|
|
|
|
|
|
|
if( uiAlignPanelStep(sa, fac) ) {
|
|
|
|
|
/* warn: this re-allocs uiblocks! */
|
|
|
|
|
scrarea_do_windraw(curarea);
|
|
|
|
|
ui_redraw_select_panel(curarea);
|
|
|
|
|
screen_swapbuffers();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
addqueue(curarea->win, REDRAW,1 ); // because 'Animate' is also called as redraw
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(result >= 1.0) break;
|
|
|
|
|
|
|
|
|
|
if(result==0.0) { // firsttime
|
|
|
|
|
time = PIL_check_seconds_timer()-ltime;
|
|
|
|
|
if(time > 0.5) fac= 0.7;
|
|
|
|
|
else if(time > 0.2) fac= 0.5;
|
|
|
|
|
else if(time > 0.1) fac= 0.4;
|
|
|
|
|
else if(time > 0.05) fac= 0.3; // 11 steps
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result= fac + (1.0-fac)*result;
|
|
|
|
|
|
|
|
|
|
if(result > 0.98) {
|
|
|
|
|
result= 1.0;
|
|
|
|
|
fac= 1.0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* only draws blocks with panels */
|
|
|
|
|
void uiDrawBlocksPanels(ScrArea *sa, int re_align)
|
|
|
|
|
{
|
|
|
|
|
uiBlock *block;
|
|
|
|
|
Panel *panot, *panew, *patest;
|
|
|
|
|
|
|
|
|
|
/* scaling contents */
|
|
|
|
|
block= sa->uiblocks.first;
|
|
|
|
|
while(block) {
|
|
|
|
|
if(block->panel) ui_scale_panel_block(block);
|
|
|
|
|
block= block->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* consistancy; are panels not made, whilst they have tabs */
|
|
|
|
|
for(panot= sa->panels.first; panot; panot= panot->next) {
|
|
|
|
|
if(panot->active==0) { // not made
|
|
|
|
|
|
|
|
|
|
for(panew= sa->panels.first; panew; panew= panew->next) {
|
|
|
|
|
if(panew->active) {
|
|
|
|
|
if(panew->paneltab==panot) { // panew is tab in notmade pa
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* now panew can become the new parent, check all other tabs */
|
|
|
|
|
if(panew) {
|
|
|
|
|
for(patest= sa->panels.first; patest; patest= patest->next) {
|
|
|
|
|
if(patest->paneltab == panot) {
|
|
|
|
|
patest->paneltab= panew;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
panot->paneltab= panew;
|
|
|
|
|
panew->paneltab= NULL;
|
|
|
|
|
addqueue(sa->win, REDRAW, 1); // the buttons panew were not made
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* re-align */
|
|
|
|
|
if(re_align) uiAlignPanelStep(sa, 1.0);
|
2003-10-16 00:17:24 +00:00
|
|
|
|
|
|
|
|
if(sa->spacetype!=SPACE_BUTS) {
|
|
|
|
|
SpaceLink *sl= sa->spacedata.first;
|
|
|
|
|
for(block= sa->uiblocks.first; block; block= block->next) {
|
|
|
|
|
if(block->panel && block->panel->active && block->panel->paneltab == NULL) {
|
2006-04-26 14:47:04 +00:00
|
|
|
float dx=0.0, dy=0.0, minx, miny, maxx, maxy, miny_panel;
|
2003-10-16 00:17:24 +00:00
|
|
|
|
|
|
|
|
minx= sl->blockscale*block->panel->ofsx;
|
|
|
|
|
maxx= sl->blockscale*(block->panel->ofsx+block->panel->sizex);
|
|
|
|
|
miny= sl->blockscale*(block->panel->ofsy+block->panel->sizey);
|
|
|
|
|
maxy= sl->blockscale*(block->panel->ofsy+block->panel->sizey+PNL_HEADER);
|
2006-04-26 14:47:04 +00:00
|
|
|
miny_panel= sl->blockscale*(block->panel->ofsy);
|
2003-10-16 00:17:24 +00:00
|
|
|
|
2006-04-26 14:47:04 +00:00
|
|
|
/* check to see if snapped panels have been left out in the open by resizing a window
|
|
|
|
|
* and if so, offset them back to where they belong */
|
|
|
|
|
if (block->panel->snap) {
|
|
|
|
|
if (((block->panel->snap) & PNL_SNAP_RIGHT) &&
|
|
|
|
|
(maxx < (float)sa->winx)) {
|
|
|
|
|
|
|
|
|
|
dx = sa->winx-maxx;
|
|
|
|
|
block->panel->ofsx+= dx/sl->blockscale;
|
|
|
|
|
}
|
|
|
|
|
if (((block->panel->snap) & PNL_SNAP_TOP) &&
|
|
|
|
|
(maxy < (float)sa->winy)) {
|
|
|
|
|
|
|
|
|
|
dy = sa->winy-maxy;
|
|
|
|
|
block->panel->ofsy+= dy/sl->blockscale;
|
|
|
|
|
}
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
|
2006-04-26 14:47:04 +00:00
|
|
|
/* reset these vars with updated panel offset distances */
|
|
|
|
|
minx= sl->blockscale*block->panel->ofsx;
|
|
|
|
|
maxx= sl->blockscale*(block->panel->ofsx+block->panel->sizex);
|
|
|
|
|
miny= sl->blockscale*(block->panel->ofsy+block->panel->sizey);
|
|
|
|
|
maxy= sl->blockscale*(block->panel->ofsy+block->panel->sizey+PNL_HEADER);
|
|
|
|
|
miny_panel= sl->blockscale*(block->panel->ofsy);
|
|
|
|
|
} else
|
|
|
|
|
/* reset to no snapping */
|
|
|
|
|
block->panel->snap = PNL_SNAP_NONE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* clip panels (headers) for non-butspace situations (maybe make optimized event later) */
|
|
|
|
|
|
|
|
|
|
/* check left and right edges */
|
|
|
|
|
if (minx < PNL_SNAP_DIST) {
|
|
|
|
|
dx = -minx;
|
|
|
|
|
block->panel->snap |= PNL_SNAP_LEFT;
|
|
|
|
|
}
|
|
|
|
|
else if (maxx > ((float)sa->winx - PNL_SNAP_DIST)) {
|
|
|
|
|
dx= sa->winx-maxx;
|
|
|
|
|
block->panel->snap |= PNL_SNAP_RIGHT;
|
|
|
|
|
}
|
|
|
|
|
if( minx + dx < 0.0) dx= -minx; // when panel cant fit, put it fixed here
|
|
|
|
|
|
|
|
|
|
/* check top and bottom edges */
|
|
|
|
|
if ((miny_panel < PNL_SNAP_DIST) && (miny_panel > -PNL_SNAP_DIST)) {
|
|
|
|
|
dy= -miny_panel;
|
|
|
|
|
block->panel->snap |= PNL_SNAP_BOTTOM;
|
|
|
|
|
}
|
|
|
|
|
if(miny < PNL_SNAP_DIST) {
|
|
|
|
|
dy= -miny;
|
|
|
|
|
block->panel->snap |= PNL_SNAP_BOTTOM;
|
|
|
|
|
}
|
|
|
|
|
else if(maxy > ((float)sa->winy - PNL_SNAP_DIST)) {
|
|
|
|
|
dy= sa->winy-maxy;
|
|
|
|
|
block->panel->snap |= PNL_SNAP_TOP;
|
|
|
|
|
}
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
if( miny + dy < 0.0) dy= -miny; // when panel cant fit, put it fixed here
|
2006-04-26 14:47:04 +00:00
|
|
|
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
|
2003-10-16 00:17:24 +00:00
|
|
|
block->panel->ofsx+= dx/sl->blockscale;
|
|
|
|
|
block->panel->ofsy+= dy/sl->blockscale;
|
|
|
|
|
|
|
|
|
|
/* copy locations */
|
|
|
|
|
for(patest= sa->panels.first; patest; patest= patest->next) {
|
|
|
|
|
if(patest->paneltab==block->panel) copy_panel_offset(patest, block->panel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* draw */
|
|
|
|
|
block= sa->uiblocks.first;
|
|
|
|
|
while(block) {
|
|
|
|
|
if(block->panel) uiDrawBlock(block);
|
|
|
|
|
block= block->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ------------ panel merging ---------------- */
|
|
|
|
|
|
|
|
|
|
static void check_panel_overlap(ScrArea *sa, Panel *panel)
|
|
|
|
|
{
|
|
|
|
|
Panel *pa= sa->panels.first;
|
|
|
|
|
|
|
|
|
|
/* also called with panel==NULL for clear */
|
|
|
|
|
|
|
|
|
|
while(pa) {
|
|
|
|
|
pa->flag &= ~PNL_OVERLAP;
|
|
|
|
|
if(panel && (pa != panel)) {
|
|
|
|
|
if(pa->paneltab==NULL && pa->active) {
|
|
|
|
|
float safex= 0.2, safey= 0.2;
|
|
|
|
|
|
|
|
|
|
if( pa->flag & PNL_CLOSEDX) safex= 0.05;
|
|
|
|
|
else if(pa->flag & PNL_CLOSEDY) safey= 0.05;
|
|
|
|
|
else if( panel->flag & PNL_CLOSEDX) safex= 0.05;
|
|
|
|
|
else if(panel->flag & PNL_CLOSEDY) safey= 0.05;
|
|
|
|
|
|
|
|
|
|
if( pa->ofsx > panel->ofsx- safex*panel->sizex)
|
|
|
|
|
if( pa->ofsx+pa->sizex < panel->ofsx+ (1.0+safex)*panel->sizex)
|
|
|
|
|
if( pa->ofsy > panel->ofsy- safey*panel->sizey)
|
|
|
|
|
if( pa->ofsy+pa->sizey < panel->ofsy+ (1.0+safey)*panel->sizey)
|
|
|
|
|
pa->flag |= PNL_OVERLAP;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void test_add_new_tabs(ScrArea *sa)
|
|
|
|
|
{
|
|
|
|
|
Panel *pa, *pasel=NULL, *palap=NULL;
|
|
|
|
|
/* search selected and overlapped panel */
|
|
|
|
|
|
|
|
|
|
pa= sa->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if(pa->active) {
|
|
|
|
|
if(pa->flag & PNL_SELECT) pasel= pa;
|
|
|
|
|
if(pa->flag & PNL_OVERLAP) palap= pa;
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(pasel && palap==NULL) {
|
|
|
|
|
|
|
|
|
|
/* copy locations */
|
|
|
|
|
pa= sa->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if(pa->paneltab==pasel) {
|
|
|
|
|
copy_panel_offset(pa, pasel);
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(pasel==NULL || palap==NULL) return;
|
|
|
|
|
|
|
|
|
|
/* the overlapped panel becomes a tab */
|
|
|
|
|
palap->paneltab= pasel;
|
|
|
|
|
|
|
|
|
|
/* the selected panel gets coords of overlapped one */
|
|
|
|
|
copy_panel_offset(pasel, palap);
|
|
|
|
|
|
|
|
|
|
/* and its tabs */
|
|
|
|
|
pa= sa->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if(pa->paneltab == pasel) {
|
|
|
|
|
copy_panel_offset(pa, palap);
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* but, the overlapped panel already can have tabs too! */
|
|
|
|
|
pa= sa->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if(pa->paneltab == palap) {
|
|
|
|
|
pa->paneltab = pasel;
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ------------ panel drag ---------------- */
|
|
|
|
|
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
static void ui_drag_panel(uiBlock *block, int doscale)
|
2003-10-15 19:23:54 +00:00
|
|
|
{
|
|
|
|
|
Panel *panel= block->panel;
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
short align=0, first=1, dx=0, dy=0, dxo=0, dyo=0, mval[2], mvalo[2];
|
|
|
|
|
short ofsx, ofsy, sizex, sizey;
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
if(curarea->spacetype==SPACE_BUTS) {
|
|
|
|
|
SpaceButs *sbuts= curarea->spacedata.first;
|
|
|
|
|
align= sbuts->align;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uiGetMouse(block->win, mvalo);
|
|
|
|
|
ofsx= block->panel->ofsx;
|
|
|
|
|
ofsy= block->panel->ofsy;
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
sizex= block->panel->sizex;
|
|
|
|
|
sizey= block->panel->sizey;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
panel->flag |= PNL_SELECT;
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
/* exception handling, 3d window preview panel */
|
|
|
|
|
if(block->drawextra==BIF_view3d_previewdraw)
|
|
|
|
|
BIF_view3d_previewrender_clear(curarea);
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
while(TRUE) {
|
|
|
|
|
|
|
|
|
|
if( !(get_mbut() & L_MOUSE) ) break;
|
|
|
|
|
|
|
|
|
|
/* first clip for window, no dragging outside */
|
|
|
|
|
getmouseco_areawin(mval);
|
|
|
|
|
if( mval[0]>0 && mval[0]<curarea->winx && mval[1]>0 && mval[1]<curarea->winy) {
|
|
|
|
|
uiGetMouse(mywinget(), mval);
|
|
|
|
|
dx= (mval[0]-mvalo[0]) & ~(PNL_GRID-1);
|
|
|
|
|
dy= (mval[1]-mvalo[1]) & ~(PNL_GRID-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(dx!=dxo || dy!=dyo || first || align) {
|
|
|
|
|
dxo= dx; dyo= dy;
|
|
|
|
|
first= 0;
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
if(doscale) {
|
|
|
|
|
panel->sizex = MAX2(sizex+dx, UI_PANEL_MINX);
|
|
|
|
|
|
|
|
|
|
if(sizey-dy < UI_PANEL_MINY) {
|
|
|
|
|
dy= -UI_PANEL_MINY+sizey;
|
|
|
|
|
}
|
|
|
|
|
panel->sizey = sizey-dy;
|
|
|
|
|
|
|
|
|
|
panel->ofsy= ofsy+dy;
|
2003-10-15 19:23:54 +00:00
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2006-04-26 14:47:04 +00:00
|
|
|
/* reset the panel snapping, to allow dragging away from snapped edges */
|
|
|
|
|
panel->snap = PNL_SNAP_NONE;
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
panel->ofsx = ofsx+dx;
|
|
|
|
|
panel->ofsy = ofsy+dy;
|
|
|
|
|
check_panel_overlap(curarea, panel);
|
|
|
|
|
|
|
|
|
|
if(align) uiAlignPanelStep(curarea, 0.2);
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
/* warn: this re-allocs blocks! */
|
|
|
|
|
scrarea_do_windraw(curarea);
|
|
|
|
|
ui_redraw_select_panel(curarea);
|
|
|
|
|
screen_swapbuffers();
|
|
|
|
|
|
|
|
|
|
/* so, we find the new block */
|
|
|
|
|
block= curarea->uiblocks.first;
|
|
|
|
|
while(block) {
|
|
|
|
|
if(block->panel == panel) break;
|
|
|
|
|
block= block->next;
|
|
|
|
|
}
|
|
|
|
|
// temporal debug
|
|
|
|
|
if(block==NULL) {
|
|
|
|
|
printf("block null while panel drag, should not happen\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* restore */
|
|
|
|
|
Mat4CpyMat4(UIwinmat, block->winmat);
|
|
|
|
|
|
|
|
|
|
/* idle for align */
|
|
|
|
|
if(dx==dxo && dy==dyo) PIL_sleep_ms(30);
|
|
|
|
|
}
|
|
|
|
|
/* idle for this poor code */
|
|
|
|
|
else PIL_sleep_ms(30);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test_add_new_tabs(curarea); // also copies locations of tabs in dragged panel
|
|
|
|
|
|
|
|
|
|
panel->flag &= ~PNL_SELECT;
|
|
|
|
|
check_panel_overlap(curarea, NULL); // clears
|
|
|
|
|
|
|
|
|
|
if(align==0) addqueue(block->win, REDRAW, 1);
|
|
|
|
|
else ui_animate_panels(curarea);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
|
|
|
|
/* exception handling, 3d window preview panel */
|
|
|
|
|
if(block->drawextra==BIF_view3d_previewdraw)
|
|
|
|
|
BIF_view3d_previewrender_signal(curarea, PR_DISPRECT);
|
Compositing workflow upgrade;
You now can set a Preview panel in the Image window, to define a sub-rect
of an image to be processed. Works like the preview in 3D Window. Just
press SHIFT+P to get it activated. Very nice speedup!
This is how it works:
- The compositor still uses the scene image size (including % setting) for
Viewer or Composite output size
- If a preview exists, it calculates the cropped rect from its position
in the Image window, and stores that in the Scene render data
- On composite execute, it copies only this part from the 'generator nodes',
right now Images or Render Results. That makes the entire composite tree
only using small rects, so it will execute fast.
- Also the render window will only display the cropped rect, and on F12
only the cropped part is being executed
- On rendering in background mode, the cropping is ignored though.
Usability notes:
- translating or zooming view will automatically invoke a recalculation
- if you zoom in on details, the calculated rect will even become smaller
- only one Imagewindow can have this Preview Panel, to prevent conflicts of
what the cropped area should be. Compositing is on Scene level, not local
per image window. (Note; 3D Previews are local per window!)
- Closing the preview panel will invoke a full-size recalculation
- All passes/layers from rendering are nicely cropped, including Z and
vectors.
The work to make the compositor do cropping was simple, but getting the
Image window displaying correctly and get all events OK was a lot of work...
indeed, we need to refactor Image Window usage once. Sorry for making the
mess even bigger now. :) I've tried not to interfere with UV edit or Paint
though... only when you're in compositing mode the panel will work.
BUG fix:
3D Preview render didn't work when multiple layers were set in the current
scene.
2006-02-09 11:07:04 +00:00
|
|
|
else if(strcmp(block->name, "image_panel_preview")==0)
|
|
|
|
|
image_preview_event(2);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void ui_panel_untab(uiBlock *block)
|
|
|
|
|
{
|
|
|
|
|
Panel *panel= block->panel, *pa, *panew=NULL;
|
|
|
|
|
short nr, mval[2], mvalo[2];
|
|
|
|
|
|
|
|
|
|
/* while hold mouse, check for movement, then untab */
|
|
|
|
|
|
|
|
|
|
uiGetMouse(block->win, mvalo);
|
|
|
|
|
while(TRUE) {
|
|
|
|
|
|
|
|
|
|
if( !(get_mbut() & L_MOUSE) ) break;
|
|
|
|
|
uiGetMouse(mywinget(), mval);
|
|
|
|
|
|
|
|
|
|
if( abs(mval[0]-mvalo[0]) + abs(mval[1]-mvalo[1]) > 6 ) {
|
|
|
|
|
/* find new parent panel */
|
|
|
|
|
nr= 0;
|
|
|
|
|
pa= curarea->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if(pa->paneltab==panel) {
|
|
|
|
|
panew= pa;
|
|
|
|
|
nr++;
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* make old tabs point to panew */
|
|
|
|
|
if(panew==NULL) printf("panel untab: shouldnt happen\n");
|
|
|
|
|
panew->paneltab= NULL;
|
|
|
|
|
|
|
|
|
|
pa= curarea->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if(pa->paneltab==panel) {
|
|
|
|
|
pa->paneltab= panew;
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
ui_drag_panel(block, 0);
|
2003-10-15 19:23:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/* idle for this poor code */
|
|
|
|
|
else PIL_sleep_ms(50);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ------------ panel events ---------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void panel_clicked_tabs(uiBlock *block, int mousex)
|
|
|
|
|
{
|
|
|
|
|
Panel *pa, *tabsel=NULL, *panel= block->panel;
|
2006-06-27 13:37:16 +00:00
|
|
|
int nr= 1, a, width, ofsx;
|
|
|
|
|
|
|
|
|
|
ofsx= PNL_ICON;
|
|
|
|
|
if(block->panel->control & UI_PNL_CLOSE) ofsx+= PNL_ICON;
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* count */
|
|
|
|
|
pa= curarea->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if(pa!=panel) {
|
2008-02-25 02:34:09 +00:00
|
|
|
if(pa->active && pa->paneltab==panel) nr++;
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(nr==1) return;
|
|
|
|
|
|
|
|
|
|
/* find clicked tab, mouse in panel coords */
|
|
|
|
|
a= 0;
|
2006-06-27 13:37:16 +00:00
|
|
|
width= (int)((float)(panel->sizex - ofsx-10)/nr);
|
2003-10-15 19:23:54 +00:00
|
|
|
pa= curarea->panels.first;
|
|
|
|
|
while(pa) {
|
2008-03-03 14:19:58 +00:00
|
|
|
if(pa==panel || (pa->active && pa->paneltab==panel)) {
|
2006-06-27 13:37:16 +00:00
|
|
|
if( (mousex > ofsx+a*width) && (mousex < ofsx+(a+1)*width) ) {
|
2003-10-15 19:23:54 +00:00
|
|
|
tabsel= pa;
|
2006-06-27 13:37:16 +00:00
|
|
|
break;
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
a++;
|
|
|
|
|
}
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(tabsel) {
|
|
|
|
|
|
|
|
|
|
if(tabsel == panel) {
|
|
|
|
|
ui_panel_untab(block);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* tabsel now becomes parent for all others */
|
|
|
|
|
panel->paneltab= tabsel;
|
|
|
|
|
tabsel->paneltab= NULL;
|
|
|
|
|
|
|
|
|
|
pa= curarea->panels.first;
|
|
|
|
|
while(pa) {
|
|
|
|
|
if(pa->paneltab == panel) pa->paneltab = tabsel;
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addqueue(curarea->win, REDRAW, 1);
|
2007-11-15 19:02:31 +00:00
|
|
|
|
|
|
|
|
/* panels now differ size.. */
|
|
|
|
|
if(curarea->spacetype==SPACE_BUTS) {
|
|
|
|
|
SpaceButs *sbuts= curarea->spacedata.first;
|
|
|
|
|
if(sbuts->align)
|
|
|
|
|
uiAlignPanelStep(curarea, 1.0);
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-25 12:26:46 +00:00
|
|
|
/* disabled /deprecated now, panels minimise in place */
|
2006-04-26 14:47:04 +00:00
|
|
|
#if 0
|
2003-10-16 00:17:24 +00:00
|
|
|
static void stow_unstow(uiBlock *block)
|
|
|
|
|
{
|
|
|
|
|
SpaceLink *sl= curarea->spacedata.first;
|
|
|
|
|
Panel *pa;
|
|
|
|
|
int ok=0, x, y, width;
|
|
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
if(block->panel->flag & PNL_CLOSEDY) { // flag has been set how it should become!
|
2003-10-16 00:17:24 +00:00
|
|
|
|
|
|
|
|
width= (curarea->winx-320)/sl->blockscale;
|
|
|
|
|
if(width<5) width= 5;
|
|
|
|
|
|
|
|
|
|
/* find empty spot in bottom */
|
|
|
|
|
for(y=4; y<100; y+= PNL_HEADER+4) {
|
|
|
|
|
for(x=4; x<width; x+= 324) {
|
|
|
|
|
ok= 1;
|
|
|
|
|
/* check overlap with other panels */
|
|
|
|
|
for(pa=curarea->panels.first; pa; pa=pa->next) {
|
|
|
|
|
if(pa!=block->panel && pa->active && pa->paneltab==NULL) {
|
|
|
|
|
if( abs(pa->ofsx-x)<320 ) {
|
|
|
|
|
if( abs(pa->ofsy+pa->sizey-y)<PNL_HEADER+4) ok= 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(ok) break;
|
|
|
|
|
}
|
|
|
|
|
if(ok) break;
|
|
|
|
|
}
|
|
|
|
|
if(ok==0) printf("still primitive code... fix!\n");
|
|
|
|
|
|
|
|
|
|
block->panel->old_ofsx= block->panel->ofsx;
|
|
|
|
|
block->panel->old_ofsy= block->panel->ofsy;
|
|
|
|
|
|
|
|
|
|
block->panel->ofsx= x;
|
|
|
|
|
block->panel->ofsy= y-block->panel->sizey;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
block->panel->ofsx= block->panel->old_ofsx;
|
|
|
|
|
block->panel->ofsy= block->panel->old_ofsy;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/* copy locations */
|
|
|
|
|
for(pa= curarea->panels.first; pa; pa= pa->next) {
|
|
|
|
|
if(pa->paneltab==block->panel) copy_panel_offset(pa, block->panel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2006-04-26 14:47:04 +00:00
|
|
|
#endif
|
2003-10-16 00:17:24 +00:00
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
/* this function is supposed to call general window drawing too */
|
|
|
|
|
/* also it supposes a block has panel, and isnt a menu */
|
|
|
|
|
void ui_do_panel(uiBlock *block, uiEvent *uevent)
|
|
|
|
|
{
|
|
|
|
|
Panel *pa;
|
|
|
|
|
int align= 0;
|
|
|
|
|
|
|
|
|
|
if(curarea->spacetype==SPACE_BUTS) {
|
|
|
|
|
SpaceButs *sbuts= curarea->spacedata.first;
|
|
|
|
|
align= sbuts->align;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* mouse coordinates in panel space! */
|
|
|
|
|
|
|
|
|
|
if(uevent->event==LEFTMOUSE && block->panel->paneltab==NULL) {
|
|
|
|
|
int button= 0;
|
|
|
|
|
|
2003-10-16 00:17:24 +00:00
|
|
|
/* check open/collapsed button */
|
2003-10-15 19:23:54 +00:00
|
|
|
if(block->panel->flag & PNL_CLOSEDX) {
|
|
|
|
|
if(uevent->mval[1] >= block->maxy) button= 1;
|
|
|
|
|
}
|
2003-10-16 00:17:24 +00:00
|
|
|
else if(block->panel->control & UI_PNL_CLOSE) {
|
|
|
|
|
if(uevent->mval[0] <= block->minx+PNL_ICON-2) button= 2;
|
|
|
|
|
else if(uevent->mval[0] <= block->minx+2*PNL_ICON+2) button= 1;
|
|
|
|
|
}
|
|
|
|
|
else if(uevent->mval[0] <= block->minx+PNL_ICON+2) {
|
|
|
|
|
button= 1;
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
|
|
|
|
|
if(button) {
|
2003-10-16 00:17:24 +00:00
|
|
|
|
|
|
|
|
if(button==2) { // close
|
|
|
|
|
rem_blockhandler(curarea, block->handler);
|
|
|
|
|
addqueue(curarea->win, REDRAW, 1);
|
|
|
|
|
}
|
2006-04-26 14:47:04 +00:00
|
|
|
else { // collapse
|
2003-10-16 00:17:24 +00:00
|
|
|
|
2006-04-26 14:47:04 +00:00
|
|
|
if(block->panel->flag & PNL_CLOSED) {
|
|
|
|
|
block->panel->flag &= ~PNL_CLOSED;
|
|
|
|
|
/* snap back up so full panel aligns with screen edge */
|
|
|
|
|
if (block->panel->snap & PNL_SNAP_BOTTOM)
|
|
|
|
|
block->panel->ofsy= 0;
|
|
|
|
|
}
|
2003-10-16 00:17:24 +00:00
|
|
|
else if(align==BUT_HORIZONTAL) block->panel->flag |= PNL_CLOSEDX;
|
2006-04-26 14:47:04 +00:00
|
|
|
else {
|
|
|
|
|
/* snap down to bottom screen edge*/
|
|
|
|
|
block->panel->flag |= PNL_CLOSEDY;
|
|
|
|
|
if (block->panel->snap & PNL_SNAP_BOTTOM)
|
|
|
|
|
block->panel->ofsy= -block->panel->sizey;
|
|
|
|
|
}
|
2003-10-16 00:17:24 +00:00
|
|
|
|
|
|
|
|
for(pa= curarea->panels.first; pa; pa= pa->next) {
|
|
|
|
|
if(pa->paneltab==block->panel) {
|
|
|
|
|
if(block->panel->flag & PNL_CLOSED) pa->flag |= PNL_CLOSED;
|
|
|
|
|
else pa->flag &= ~PNL_CLOSED;
|
|
|
|
|
}
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(align==0) addqueue(block->win, REDRAW, 1);
|
|
|
|
|
else ui_animate_panels(curarea);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if(block->panel->flag & PNL_CLOSED) {
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
ui_drag_panel(block, 0);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
/* check if clicked in tabbed area */
|
|
|
|
|
else if(uevent->mval[0] < block->maxx-PNL_ICON-3 && panel_has_tabs(block->panel)) {
|
|
|
|
|
panel_clicked_tabs(block, uevent->mval[0]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
ui_drag_panel(block, 0);
|
2003-10-15 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
/* panel with scaling widget */
|
|
|
|
|
void ui_scale_panel(uiBlock *block)
|
|
|
|
|
{
|
|
|
|
|
if(block->panel->flag & PNL_CLOSED)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ui_drag_panel(block, 1);
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-15 19:23:54 +00:00
|
|
|
|