2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-24 10:33:10 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-24 10:33:10 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
* Contributor(s): Nathan Letwory
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/space_node/node_draw.c
|
|
|
|
* \ingroup spnode
|
2012-07-14 15:29:45 +00:00
|
|
|
* \brief higher level node drawing for the node editor.
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
#include "DNA_node_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2009-09-30 18:18:32 +00:00
|
|
|
#include "BLI_blenlib.h"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-03-17 14:42:44 +00:00
|
|
|
#include "BLF_translation.h"
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
#include "BKE_context.h"
|
2009-10-07 14:48:29 +00:00
|
|
|
#include "BKE_depsgraph.h"
|
2008-12-24 10:33:10 +00:00
|
|
|
#include "BKE_main.h"
|
2011-02-08 12:54:32 +00:00
|
|
|
#include "BKE_node.h"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
2.5
Added WM Jobs manager
- WM can manage threaded jobs for you; just provide a couple
of components to get it work:
- customdata, free callback for it
- timer step, notifier code
- start callback, update callback
- Once started, each job runs an own timer, and will for
every time step check necessary updates, or close the
job when ready.
- No drawing happens in jobs, that's for notifiers!
- Every job stores an owner pointer, and based on this owner
it will prevent multiple jobs to enter the stack.
Instead it will re-use a running job, signal it to stop
and allow caller to re-initialize it even.
- Check new wm_jobs.c for more explanation. Jobs API is still
under construction.
Fun: BLI_addtail(&wm->jobs, steve); :)
Put Node shader previews back using wmJobs
- Preview calculating is now fully threaded (1 thread still)
- Thanks to new event system + notifiers, you can see
previews update even while dragging sliders!
- Currently it only starts when you change a node setting.
Warning: the thread render shares Node data, so don't delete
nodes while it renders! This topic is on the todo to make safe.
Also:
- bug in region initialize (do_versions) showed channel list in
node editor wrong.
- flagged the channel list 'hidden' now, it was really in the
way! This is for later to work on anyway.
- recoded Render API callbacks so it gets handlers passed on,
no globals to use anymore, remember?
- previewrender code gets now so much nicer! Will remove a lot
of stuff from code soon.
2009-01-22 14:59:49 +00:00
|
|
|
#include "WM_types.h"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
#include "ED_node.h"
|
2009-11-11 08:12:54 +00:00
|
|
|
#include "ED_gpencil.h"
|
2012-06-29 14:34:46 +00:00
|
|
|
#include "ED_space_api.h"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
2009-09-16 18:59:13 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
2012-08-02 23:03:16 +00:00
|
|
|
#include "node_intern.h" /* own include */
|
2012-07-10 12:23:49 +00:00
|
|
|
#include "COM_compositor.h"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-07-09 23:07:15 +00:00
|
|
|
/* XXX interface.h */
|
2012-09-15 11:48:20 +00:00
|
|
|
extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* XXX update functions for node editor are a mess, needs a clear concept */
|
|
|
|
void ED_node_tree_update(SpaceNode *snode, Scene *scene)
|
|
|
|
{
|
|
|
|
snode_set_context(snode, scene);
|
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
if (snode->nodetree && snode->nodetree->id.us == 0)
|
|
|
|
snode->nodetree->id.us = 1;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
2009-10-07 22:05:30 +00:00
|
|
|
void ED_node_changed_update(ID *id, bNode *node)
|
2009-09-16 18:59:13 +00:00
|
|
|
{
|
2009-10-07 22:05:30 +00:00
|
|
|
bNodeTree *nodetree, *edittree;
|
|
|
|
int treetype;
|
2009-09-16 18:59:13 +00:00
|
|
|
|
2009-10-07 22:05:30 +00:00
|
|
|
node_tree_from_ID(id, &nodetree, &edittree, &treetype);
|
2009-09-16 18:59:13 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
if (treetype == NTREE_SHADER) {
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(id, 0);
|
2011-11-02 18:55:32 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (GS(id->name) == ID_MA)
|
2012-07-09 19:58:36 +00:00
|
|
|
WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, id);
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (GS(id->name) == ID_LA)
|
2012-07-09 19:58:36 +00:00
|
|
|
WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, id);
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (GS(id->name) == ID_WO)
|
2012-07-09 19:58:36 +00:00
|
|
|
WM_main_add_notifier(NC_WORLD | ND_WORLD_DRAW, id);
|
2009-09-16 18:59:13 +00:00
|
|
|
}
|
2012-07-09 19:58:36 +00:00
|
|
|
else if (treetype == NTREE_COMPOSIT) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node)
|
2011-11-07 17:30:52 +00:00
|
|
|
nodeUpdate(edittree, node);
|
2009-09-16 18:59:13 +00:00
|
|
|
/* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */
|
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
node = node_tree_get_editgroup(nodetree);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node)
|
2011-10-19 17:08:35 +00:00
|
|
|
nodeUpdateID(nodetree, node->id);
|
2009-10-07 22:05:30 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
WM_main_add_notifier(NC_SCENE | ND_NODES, id);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2012-07-09 19:58:36 +00:00
|
|
|
else if (treetype == NTREE_TEXTURE) {
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(id, 0);
|
2012-07-09 19:58:36 +00:00
|
|
|
WM_main_add_notifier(NC_TEXTURE | ND_NODES, id);
|
2009-09-16 18:59:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-15 04:54:31 +00:00
|
|
|
static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
|
|
|
|
{
|
|
|
|
bNode *node;
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ntree == lookup)
|
2010-03-15 04:54:31 +00:00
|
|
|
return 1;
|
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
for (node = ntree->nodes.first; node; node = node->next)
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->type == NODE_GROUP && node->id)
|
2012-07-09 19:58:36 +00:00
|
|
|
if (has_nodetree((bNodeTree *)node->id, lookup))
|
2010-03-15 04:54:31 +00:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
typedef struct NodeUpdateCalldata {
|
|
|
|
bNodeTree *ntree;
|
|
|
|
bNode *node;
|
|
|
|
} NodeUpdateCalldata;
|
|
|
|
static void node_generic_update_cb(void *calldata, ID *owner_id, bNodeTree *ntree)
|
|
|
|
{
|
2012-07-09 19:58:36 +00:00
|
|
|
NodeUpdateCalldata *cd = (NodeUpdateCalldata *)calldata;
|
2011-09-05 21:01:50 +00:00
|
|
|
/* check if nodetree uses the group stored in calldata */
|
|
|
|
if (has_nodetree(ntree, cd->ntree))
|
|
|
|
ED_node_changed_update(owner_id, cd->node);
|
|
|
|
}
|
2010-10-15 04:27:09 +00:00
|
|
|
void ED_node_generic_update(Main *bmain, bNodeTree *ntree, bNode *node)
|
2010-03-15 04:54:31 +00:00
|
|
|
{
|
2012-07-09 19:58:36 +00:00
|
|
|
bNodeTreeType *tti = ntreeGetType(ntree->type);
|
2011-09-05 21:01:50 +00:00
|
|
|
NodeUpdateCalldata cd;
|
|
|
|
cd.ntree = ntree;
|
|
|
|
cd.node = node;
|
2010-03-15 04:54:31 +00:00
|
|
|
/* look through all datablocks, to support groups */
|
2011-09-05 21:01:50 +00:00
|
|
|
tti->foreach_nodetree(bmain, &cd, node_generic_update_cb);
|
2010-04-05 17:30:11 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ntree->type == NTREE_TEXTURE)
|
2010-04-05 17:30:11 +00:00
|
|
|
ntreeTexCheckCyclics(ntree);
|
2010-03-15 04:54:31 +00:00
|
|
|
}
|
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
static int compare_nodes(bNode *a, bNode *b)
|
|
|
|
{
|
|
|
|
bNode *parent;
|
|
|
|
/* These tell if either the node or any of the parent nodes is selected.
|
|
|
|
* A selected parent means an unselected node is also in foreground!
|
|
|
|
*/
|
2012-07-09 19:58:36 +00:00
|
|
|
int a_select = (a->flag & NODE_SELECT), b_select = (b->flag & NODE_SELECT);
|
|
|
|
int a_active = (a->flag & NODE_ACTIVE), b_active = (b->flag & NODE_ACTIVE);
|
2012-05-22 14:13:33 +00:00
|
|
|
|
|
|
|
/* if one is an ancestor of the other */
|
|
|
|
/* XXX there might be a better sorting algorithm for stable topological sort, this is O(n^2) worst case */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (parent = a->parent; parent; parent = parent->parent) {
|
2012-05-22 14:13:33 +00:00
|
|
|
/* if b is an ancestor, it is always behind a */
|
2012-07-09 19:58:36 +00:00
|
|
|
if (parent == b)
|
2012-05-22 14:13:33 +00:00
|
|
|
return 1;
|
|
|
|
/* any selected ancestor moves the node forward */
|
|
|
|
if (parent->flag & NODE_ACTIVE)
|
|
|
|
a_active = 1;
|
|
|
|
if (parent->flag & NODE_SELECT)
|
|
|
|
a_select = 1;
|
|
|
|
}
|
2012-07-09 19:58:36 +00:00
|
|
|
for (parent = b->parent; parent; parent = parent->parent) {
|
2012-05-22 14:13:33 +00:00
|
|
|
/* if a is an ancestor, it is always behind b */
|
2012-07-09 19:58:36 +00:00
|
|
|
if (parent == a)
|
2012-05-22 14:13:33 +00:00
|
|
|
return 0;
|
|
|
|
/* any selected ancestor moves the node forward */
|
|
|
|
if (parent->flag & NODE_ACTIVE)
|
|
|
|
b_active = 1;
|
|
|
|
if (parent->flag & NODE_SELECT)
|
|
|
|
b_select = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if one of the nodes is in the background and the other not */
|
|
|
|
if ((a->flag & NODE_BACKGROUND) && !(b->flag & NODE_BACKGROUND))
|
|
|
|
return 0;
|
|
|
|
else if (!(a->flag & NODE_BACKGROUND) && (b->flag & NODE_BACKGROUND))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* if one has a higher selection state (active > selected > nothing) */
|
|
|
|
if (!b_active && a_active)
|
|
|
|
return 1;
|
|
|
|
else if (!b_select && (a_active || a_select))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Sorts nodes by selection: unselected nodes first, then selected,
|
|
|
|
* then the active node at the very end. Relative order is kept intact!
|
|
|
|
*/
|
|
|
|
void ED_node_sort(bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
/* merge sort is the algorithm of choice here */
|
|
|
|
bNode *first_a, *first_b, *node_a, *node_b, *tmp;
|
2012-07-09 19:58:36 +00:00
|
|
|
int totnodes = BLI_countlist(&ntree->nodes);
|
2012-05-22 14:13:33 +00:00
|
|
|
int k, a, b;
|
|
|
|
|
|
|
|
k = 1;
|
|
|
|
while (k < totnodes) {
|
|
|
|
first_a = first_b = ntree->nodes.first;
|
|
|
|
|
|
|
|
do {
|
|
|
|
/* setup first_b pointer */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (b = 0; b < k && first_b; ++b) {
|
2012-05-22 14:13:33 +00:00
|
|
|
first_b = first_b->next;
|
|
|
|
}
|
|
|
|
/* all batches merged? */
|
2012-07-09 19:58:36 +00:00
|
|
|
if (first_b == NULL)
|
2012-05-22 14:13:33 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* merge batches */
|
|
|
|
node_a = first_a;
|
|
|
|
node_b = first_b;
|
|
|
|
a = b = 0;
|
|
|
|
while (a < k && b < k && node_b) {
|
2012-07-09 19:58:36 +00:00
|
|
|
if (compare_nodes(node_a, node_b) == 0) {
|
2012-05-22 14:13:33 +00:00
|
|
|
node_a = node_a->next;
|
2012-08-22 16:44:32 +00:00
|
|
|
a++;
|
2012-05-22 14:13:33 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
tmp = node_b;
|
|
|
|
node_b = node_b->next;
|
2012-08-22 16:44:32 +00:00
|
|
|
b++;
|
2012-05-22 14:13:33 +00:00
|
|
|
BLI_remlink(&ntree->nodes, tmp);
|
|
|
|
BLI_insertlinkbefore(&ntree->nodes, node_a, tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup first pointers for next batch */
|
|
|
|
first_b = node_b;
|
|
|
|
for (; b < k; ++b) {
|
|
|
|
/* all nodes sorted? */
|
2012-07-09 19:58:36 +00:00
|
|
|
if (first_b == NULL)
|
2012-05-22 14:13:33 +00:00
|
|
|
break;
|
|
|
|
first_b = first_b->next;
|
|
|
|
}
|
|
|
|
first_a = first_b;
|
|
|
|
} while (first_b);
|
|
|
|
|
|
|
|
k = k << 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 18:59:13 +00:00
|
|
|
static void do_node_internal_buttons(bContext *C, void *node_v, int event)
|
|
|
|
{
|
2012-07-09 19:58:36 +00:00
|
|
|
if (event == B_NODE_EXEC) {
|
|
|
|
SpaceNode *snode = CTX_wm_space_node(C);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (snode && snode->id)
|
2009-10-07 22:05:30 +00:00
|
|
|
ED_node_changed_update(snode->id, node_v);
|
|
|
|
}
|
2009-09-16 18:59:13 +00:00
|
|
|
}
|
|
|
|
|
2010-01-12 07:07:51 +00:00
|
|
|
static void node_uiblocks_init(const bContext *C, bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
bNode *node;
|
2012-01-11 09:33:44 +00:00
|
|
|
char uiblockstr[32];
|
2010-01-12 07:07:51 +00:00
|
|
|
|
2011-11-22 17:49:06 +00:00
|
|
|
/* add node uiBlocks in drawing order - prevents events going to overlapping nodes */
|
2010-01-12 07:07:51 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
for (node = ntree->nodes.first; node; node = node->next) {
|
2012-01-11 09:33:44 +00:00
|
|
|
/* ui block */
|
2012-01-11 12:56:31 +00:00
|
|
|
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "node buttons %p", (void *)node);
|
2012-07-09 19:58:36 +00:00
|
|
|
node->block = uiBeginBlock(C, CTX_wm_region(C), uiblockstr, UI_EMBOSS);
|
2012-01-11 09:33:44 +00:00
|
|
|
uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node);
|
|
|
|
|
|
|
|
/* this cancels events for background nodes */
|
|
|
|
uiBlockSetFlag(node->block, UI_BLOCK_CLIP_EVENTS);
|
2010-01-12 07:07:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
void node_to_view(struct bNode *node, float x, float y, float *rx, float *ry)
|
|
|
|
{
|
|
|
|
nodeToView(node, x, y, rx, ry);
|
|
|
|
*rx *= UI_DPI_FAC;
|
|
|
|
*ry *= UI_DPI_FAC;
|
|
|
|
}
|
|
|
|
|
|
|
|
void node_from_view(struct bNode *node, float x, float y, float *rx, float *ry)
|
|
|
|
{
|
|
|
|
x /= UI_DPI_FAC;
|
|
|
|
y /= UI_DPI_FAC;
|
|
|
|
nodeFromView(node, x, y, rx, ry);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* based on settings in node, sets drawing rect info. each redraw! */
|
2011-09-05 21:01:50 +00:00
|
|
|
static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2009-09-16 18:59:13 +00:00
|
|
|
uiLayout *layout;
|
|
|
|
PointerRNA ptr;
|
2008-12-24 10:33:10 +00:00
|
|
|
bNodeSocket *nsock;
|
2011-09-05 21:01:50 +00:00
|
|
|
float locx, locy;
|
2011-09-08 07:01:29 +00:00
|
|
|
float dy;
|
2009-09-16 18:59:13 +00:00
|
|
|
int buty;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* get "global" coords */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
node_to_view(node, 0.0f, 0.0f, &locx, &locy);
|
2012-07-09 19:58:36 +00:00
|
|
|
dy = locy;
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* header */
|
2012-07-09 19:58:36 +00:00
|
|
|
dy -= NODE_DY;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* little bit space in top */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->outputs.first)
|
2012-07-09 19:58:36 +00:00
|
|
|
dy -= NODE_DYS / 2;
|
2009-09-16 18:59:13 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* output sockets */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (nsock = node->outputs.first; nsock; nsock = nsock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodeSocketIsHidden(nsock)) {
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
nsock->locx = locx + NODE_WIDTH(node);
|
2012-07-09 19:58:36 +00:00
|
|
|
nsock->locy = dy - NODE_DYS;
|
|
|
|
dy -= NODE_DY;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-16 18:59:13 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
node->prvr.xmin = locx + NODE_DYS;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
node->prvr.xmax = locx + NODE_WIDTH(node) - NODE_DYS;
|
2010-02-16 15:59:36 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* preview rect? */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_PREVIEW) {
|
|
|
|
if (node->preview && node->preview->rect) {
|
2012-07-09 19:58:36 +00:00
|
|
|
float aspect = 1.0f;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->preview && node->preview->xsize && node->preview->ysize)
|
2012-07-09 19:58:36 +00:00
|
|
|
aspect = (float)node->preview->ysize / (float)node->preview->xsize;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
dy -= NODE_DYS / 2;
|
2012-03-24 02:51:46 +00:00
|
|
|
node->prvr.ymax = dy;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (aspect <= 1.0f)
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
node->prvr.ymin = dy - aspect * (NODE_WIDTH(node) - NODE_DY);
|
2008-12-24 10:33:10 +00:00
|
|
|
else {
|
2012-07-09 23:07:15 +00:00
|
|
|
/* width correction of image */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* XXX huh? (ton) */
|
|
|
|
float dx = (NODE_WIDTH(node) - NODE_DYS) - (NODE_WIDTH(node) - NODE_DYS) / aspect;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
node->prvr.ymin = dy - (NODE_WIDTH(node) - NODE_DY);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
node->prvr.xmin += 0.5f * dx;
|
|
|
|
node->prvr.xmax -= 0.5f * dx;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
dy = node->prvr.ymin - NODE_DYS / 2;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* make sure that maximums are bigger or equal to minimums */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->prvr.xmax < node->prvr.xmin) SWAP(float, node->prvr.xmax, node->prvr.xmin);
|
|
|
|
if (node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-09-15 11:48:20 +00:00
|
|
|
float oldh = BLI_rctf_size_y(&node->prvr);
|
2012-07-09 19:58:36 +00:00
|
|
|
if (oldh == 0.0f)
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
oldh = 0.6f * NODE_WIDTH(node) - NODE_DY;
|
2012-07-09 19:58:36 +00:00
|
|
|
dy -= NODE_DYS / 2;
|
2012-03-24 02:51:46 +00:00
|
|
|
node->prvr.ymax = dy;
|
|
|
|
node->prvr.ymin = dy - oldh;
|
2012-07-09 19:58:36 +00:00
|
|
|
dy = node->prvr.ymin - NODE_DYS / 2;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* buttons rect? */
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
|
2012-07-09 19:58:36 +00:00
|
|
|
dy -= NODE_DYS / 2;
|
2009-09-16 18:59:13 +00:00
|
|
|
|
|
|
|
/* set this for uifunc() that don't use layout engine yet */
|
2012-03-24 02:51:46 +00:00
|
|
|
node->butr.xmin = 0;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
node->butr.xmax = NODE_WIDTH(node) - 2 * NODE_DYS;
|
2012-03-24 02:51:46 +00:00
|
|
|
node->butr.ymin = 0;
|
|
|
|
node->butr.ymax = 0;
|
2011-03-11 03:27:38 +00:00
|
|
|
|
2009-09-16 18:59:13 +00:00
|
|
|
RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
layout = uiBlockLayout(node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
locx + NODE_DYS, dy, node->butr.xmax, 0, UI_GetStyle());
|
2012-05-02 07:18:51 +00:00
|
|
|
uiLayoutSetContextPointer(layout, "node", &ptr);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2009-11-10 04:01:44 +00:00
|
|
|
node->typeinfo->uifunc(layout, (bContext *)C, &ptr);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2009-09-16 18:59:13 +00:00
|
|
|
uiBlockEndAlign(node->block);
|
|
|
|
uiBlockLayoutResolve(node->block, NULL, &buty);
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
dy = buty - NODE_DYS / 2;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2009-09-16 18:59:13 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* input sockets */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (nsock = node->inputs.first; nsock; nsock = nsock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodeSocketIsHidden(nsock)) {
|
2012-07-09 19:58:36 +00:00
|
|
|
nsock->locx = locx;
|
|
|
|
nsock->locy = dy - NODE_DYS;
|
|
|
|
dy -= NODE_DY;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* little bit space in end */
|
2012-07-09 19:58:36 +00:00
|
|
|
if (node->inputs.first || (node->flag & (NODE_OPTIONS | NODE_PREVIEW)) == 0)
|
|
|
|
dy -= NODE_DYS / 2;
|
2009-09-16 18:59:13 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
node->totr.xmin = locx;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
node->totr.xmax = locx + NODE_WIDTH(node);
|
2012-03-24 02:51:46 +00:00
|
|
|
node->totr.ymax = locy;
|
2012-10-23 13:28:22 +00:00
|
|
|
node->totr.ymin = min_ff(dy, locy - 2 * NODE_DY);
|
2011-11-22 17:49:06 +00:00
|
|
|
|
|
|
|
/* Set the block bounds to clip mouse events from underlying nodes.
|
|
|
|
* Add a margin for sockets on each side.
|
|
|
|
*/
|
|
|
|
uiExplicitBoundsBlock(node->block,
|
2012-07-09 19:58:36 +00:00
|
|
|
node->totr.xmin - NODE_SOCKSIZE,
|
|
|
|
node->totr.ymin,
|
|
|
|
node->totr.xmax + NODE_SOCKSIZE,
|
|
|
|
node->totr.ymax);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* based on settings in node, sets drawing rect info. each redraw! */
|
2010-10-15 04:27:09 +00:00
|
|
|
static void node_update_hidden(bNode *node)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
|
|
|
bNodeSocket *nsock;
|
2011-09-05 21:01:50 +00:00
|
|
|
float locx, locy;
|
2012-07-09 19:58:36 +00:00
|
|
|
float rad, drad, hiddenrad = HIDDEN_RAD;
|
|
|
|
int totin = 0, totout = 0, tot;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* get "global" coords */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
node_to_view(node, 0.0f, 0.0f, &locx, &locy);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* calculate minimal radius */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (nsock = node->inputs.first; nsock; nsock = nsock->next)
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodeSocketIsHidden(nsock))
|
2008-12-24 10:33:10 +00:00
|
|
|
totin++;
|
2012-07-09 19:58:36 +00:00
|
|
|
for (nsock = node->outputs.first; nsock; nsock = nsock->next)
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodeSocketIsHidden(nsock))
|
2008-12-24 10:33:10 +00:00
|
|
|
totout++;
|
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
tot = MAX2(totin, totout);
|
|
|
|
if (tot > 4) {
|
|
|
|
hiddenrad += 5.0f * (float)(tot - 4);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
node->totr.xmin = locx;
|
2012-07-09 19:58:36 +00:00
|
|
|
node->totr.xmax = locx + 3 * hiddenrad + node->miniwidth;
|
|
|
|
node->totr.ymax = locy + (hiddenrad - 0.5f * NODE_DY);
|
|
|
|
node->totr.ymin = node->totr.ymax - 2 * hiddenrad;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* output sockets */
|
2012-07-09 19:58:36 +00:00
|
|
|
rad = drad = (float)M_PI / (1.0f + (float)totout);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
for (nsock = node->outputs.first; nsock; nsock = nsock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodeSocketIsHidden(nsock)) {
|
2013-01-12 14:28:23 +00:00
|
|
|
nsock->locx = node->totr.xmax - hiddenrad + sinf(rad) * hiddenrad;
|
|
|
|
nsock->locy = node->totr.ymin + hiddenrad + cosf(rad) * hiddenrad;
|
2012-07-09 19:58:36 +00:00
|
|
|
rad += drad;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* input sockets */
|
2012-07-09 19:58:36 +00:00
|
|
|
rad = drad = -(float)M_PI / (1.0f + (float)totin);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
for (nsock = node->inputs.first; nsock; nsock = nsock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodeSocketIsHidden(nsock)) {
|
2013-01-12 14:28:23 +00:00
|
|
|
nsock->locx = node->totr.xmin + hiddenrad + sinf(rad) * hiddenrad;
|
|
|
|
nsock->locy = node->totr.ymin + hiddenrad + cosf(rad) * hiddenrad;
|
2012-07-09 19:58:36 +00:00
|
|
|
rad += drad;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
}
|
2011-11-22 17:49:06 +00:00
|
|
|
|
|
|
|
/* Set the block bounds to clip mouse events from underlying nodes.
|
|
|
|
* Add a margin for sockets on each side.
|
|
|
|
*/
|
|
|
|
uiExplicitBoundsBlock(node->block,
|
2012-07-09 19:58:36 +00:00
|
|
|
node->totr.xmin - NODE_SOCKSIZE,
|
|
|
|
node->totr.ymin,
|
|
|
|
node->totr.xmax + NODE_SOCKSIZE,
|
|
|
|
node->totr.ymax);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_HIDDEN)
|
2011-09-05 21:01:50 +00:00
|
|
|
node_update_hidden(node);
|
|
|
|
else
|
|
|
|
node_update_basis(C, ntree, node);
|
|
|
|
}
|
|
|
|
|
2012-06-01 12:38:03 +00:00
|
|
|
int node_select_area_default(bNode *node, int x, int y)
|
|
|
|
{
|
2012-08-23 18:25:45 +00:00
|
|
|
return BLI_rctf_isect_pt(&node->totr, x, y);
|
2012-06-01 12:38:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int node_tweak_area_default(bNode *node, int x, int y)
|
|
|
|
{
|
2012-08-23 18:25:45 +00:00
|
|
|
return BLI_rctf_isect_pt(&node->totr, x, y);
|
2012-06-01 12:38:03 +00:00
|
|
|
}
|
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
int node_get_colorid(bNode *node)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2013-01-19 04:20:53 +00:00
|
|
|
switch (node->typeinfo->nclass) {
|
|
|
|
case NODE_CLASS_INPUT: return TH_NODE_IN_OUT;
|
|
|
|
case NODE_CLASS_OUTPUT: return (node->flag & NODE_DO_OUTPUT) ? TH_NODE_IN_OUT : TH_NODE;
|
|
|
|
case NODE_CLASS_CONVERTOR: return TH_NODE_CONVERTOR;
|
|
|
|
case NODE_CLASS_OP_COLOR:
|
|
|
|
case NODE_CLASS_OP_VECTOR:
|
|
|
|
case NODE_CLASS_OP_FILTER: return TH_NODE_OPERATOR;
|
|
|
|
case NODE_CLASS_GROUP: return TH_NODE_GROUP;
|
|
|
|
case NODE_CLASS_MATTE: return TH_NODE_MATTE;
|
|
|
|
case NODE_CLASS_DISTORT: return TH_NODE_DISTORT;
|
|
|
|
default: return TH_NODE;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-20 16:38:23 +00:00
|
|
|
/* note: in cmp_util.c is similar code, for node_compo_pass_on()
|
|
|
|
* the same goes for shader and texture nodes. */
|
2011-07-12 18:59:54 +00:00
|
|
|
/* note: in node_edit.c is similar code, for untangle node */
|
2008-12-24 10:33:10 +00:00
|
|
|
static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
|
|
|
|
{
|
2012-02-27 17:38:16 +00:00
|
|
|
bNodeLink *link;
|
2011-11-20 16:38:23 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
glEnable(GL_BLEND);
|
2011-11-20 16:38:23 +00:00
|
|
|
glEnable(GL_LINE_SMOOTH);
|
|
|
|
|
2012-10-25 16:49:06 +00:00
|
|
|
for (link = node->internal_links.first; link; link = link->next)
|
2012-02-27 17:38:16 +00:00
|
|
|
node_draw_link_bezier(v2d, snode, link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE);
|
2011-11-20 16:38:23 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
glDisable(GL_BLEND);
|
2011-11-20 16:38:23 +00:00
|
|
|
glDisable(GL_LINE_SMOOTH);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* this might have some more generic use */
|
2012-03-09 10:16:41 +00:00
|
|
|
static void node_circle_draw(float x, float y, float size, char *col, int highlight)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
|
|
|
/* 16 values of sin function */
|
|
|
|
static float si[16] = {
|
2012-04-29 15:47:02 +00:00
|
|
|
0.00000000f, 0.39435585f, 0.72479278f, 0.93775213f,
|
|
|
|
0.99871650f, 0.89780453f, 0.65137248f, 0.29936312f,
|
|
|
|
-0.10116832f, -0.48530196f, -0.79077573f, -0.96807711f,
|
|
|
|
-0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f
|
2008-12-24 10:33:10 +00:00
|
|
|
};
|
|
|
|
/* 16 values of cos function */
|
2012-07-09 19:58:36 +00:00
|
|
|
static float co[16] = {
|
2012-04-29 15:47:02 +00:00
|
|
|
1.00000000f, 0.91895781f, 0.68896691f, 0.34730525f,
|
|
|
|
-0.05064916f, -0.44039415f, -0.75875812f, -0.95413925f,
|
|
|
|
-0.99486932f, -0.87434661f, -0.61210598f, -0.25065253f,
|
|
|
|
0.15142777f, 0.52896401f, 0.82076344f, 0.97952994f,
|
2008-12-24 10:33:10 +00:00
|
|
|
};
|
|
|
|
int a;
|
|
|
|
|
|
|
|
glColor3ub(col[0], col[1], col[2]);
|
|
|
|
|
|
|
|
glBegin(GL_POLYGON);
|
2012-07-09 19:58:36 +00:00
|
|
|
for (a = 0; a < 16; a++)
|
|
|
|
glVertex2f(x + size * si[a], y + size * co[a]);
|
2008-12-24 10:33:10 +00:00
|
|
|
glEnd();
|
|
|
|
|
2012-03-09 10:16:41 +00:00
|
|
|
if (highlight) {
|
|
|
|
UI_ThemeColor(TH_TEXT_HI);
|
|
|
|
glLineWidth(1.5f);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
glColor4ub(0, 0, 0, 150);
|
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
glEnable(GL_BLEND);
|
2012-04-29 17:11:40 +00:00
|
|
|
glEnable(GL_LINE_SMOOTH);
|
2008-12-24 10:33:10 +00:00
|
|
|
glBegin(GL_LINE_LOOP);
|
2012-07-09 19:58:36 +00:00
|
|
|
for (a = 0; a < 16; a++)
|
|
|
|
glVertex2f(x + size * si[a], y + size * co[a]);
|
2008-12-24 10:33:10 +00:00
|
|
|
glEnd();
|
2012-04-29 17:11:40 +00:00
|
|
|
glDisable(GL_LINE_SMOOTH);
|
2008-12-24 10:33:10 +00:00
|
|
|
glDisable(GL_BLEND);
|
2012-03-09 10:16:41 +00:00
|
|
|
glLineWidth(1.0f);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
2012-06-01 12:38:03 +00:00
|
|
|
void node_socket_circle_draw(bNodeTree *UNUSED(ntree), bNodeSocket *sock, float size, int highlight)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2011-09-05 21:01:50 +00:00
|
|
|
bNodeSocketType *stype = ntreeGetSocketType(sock->type);
|
2012-06-01 12:38:03 +00:00
|
|
|
node_circle_draw(sock->locx, sock->locy, size, stype->ui_color, highlight);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************** Socket callbacks *********** */
|
|
|
|
|
|
|
|
/* not a callback */
|
|
|
|
static void node_draw_preview(bNodePreview *preview, rctf *prv)
|
|
|
|
{
|
2012-09-15 11:48:20 +00:00
|
|
|
float xscale = BLI_rctf_size_x(prv) / ((float)preview->xsize);
|
|
|
|
float yscale = BLI_rctf_size_y(prv) / ((float)preview->ysize);
|
|
|
|
float tile = BLI_rctf_size_x(prv) / 10.0f;
|
2008-12-24 10:33:10 +00:00
|
|
|
float x, y;
|
|
|
|
|
|
|
|
/* draw checkerboard backdrop to show alpha */
|
|
|
|
glColor3ub(120, 120, 120);
|
|
|
|
glRectf(prv->xmin, prv->ymin, prv->xmax, prv->ymax);
|
|
|
|
glColor3ub(160, 160, 160);
|
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
for (y = prv->ymin; y < prv->ymax; y += tile * 2) {
|
|
|
|
for (x = prv->xmin; x < prv->xmax; x += tile * 2) {
|
|
|
|
float tilex = tile, tiley = tile;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
if (x + tile > prv->xmax)
|
|
|
|
tilex = prv->xmax - x;
|
|
|
|
if (y + tile > prv->ymax)
|
|
|
|
tiley = prv->ymax - y;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
glRectf(x, y, x + tilex, y + tiley);
|
|
|
|
}
|
|
|
|
}
|
2012-07-09 19:58:36 +00:00
|
|
|
for (y = prv->ymin + tile; y < prv->ymax; y += tile * 2) {
|
|
|
|
for (x = prv->xmin + tile; x < prv->xmax; x += tile * 2) {
|
|
|
|
float tilex = tile, tiley = tile;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
if (x + tile > prv->xmax)
|
|
|
|
tilex = prv->xmax - x;
|
|
|
|
if (y + tile > prv->ymax)
|
|
|
|
tiley = prv->ymax - y;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
glRectf(x, y, x + tilex, y + tiley);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-14 07:02:11 +00:00
|
|
|
glPixelZoom(xscale, yscale);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
2012-04-29 17:11:40 +00:00
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* premul graphics */
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
glColor4f(1.0, 1.0, 1.0, 1.0);
|
2009-10-07 22:05:30 +00:00
|
|
|
glaDrawPixelsTex(prv->xmin, prv->ymin, preview->xsize, preview->ysize, GL_UNSIGNED_BYTE, preview->rect);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
glPixelZoom(1.0f, 1.0f);
|
|
|
|
|
|
|
|
UI_ThemeColorShadeAlpha(TH_BACK, -15, +100);
|
|
|
|
fdrawbox(prv->xmin, prv->ymin, prv->xmax, prv->ymax);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-12-18 12:51:50 +00:00
|
|
|
/* common handle function for operator buttons that need to select the node first */
|
|
|
|
static void node_toggle_button_cb(struct bContext *C, void *node_argv, void *op_argv)
|
|
|
|
{
|
2012-07-09 19:58:36 +00:00
|
|
|
bNode *node = (bNode *)node_argv;
|
2011-12-18 12:51:50 +00:00
|
|
|
const char *opname = (const char *)op_argv;
|
|
|
|
|
|
|
|
/* select & activate only the button's node */
|
|
|
|
node_select_single(C, node);
|
|
|
|
|
|
|
|
WM_operator_name_call(C, opname, WM_OP_INVOKE_DEFAULT, NULL);
|
|
|
|
}
|
|
|
|
|
2012-06-01 14:42:21 +00:00
|
|
|
void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha)
|
2012-05-22 14:13:33 +00:00
|
|
|
{
|
|
|
|
rctf *rct = &node->totr;
|
|
|
|
|
|
|
|
uiSetRoundBox(UI_CNR_ALL);
|
2012-07-09 19:58:36 +00:00
|
|
|
if (node->parent == NULL)
|
2012-06-01 14:42:21 +00:00
|
|
|
ui_dropshadow(rct, radius, snode->aspect, alpha, node->flag & SELECT);
|
2012-05-22 14:13:33 +00:00
|
|
|
else {
|
|
|
|
const float margin = 3.0f;
|
|
|
|
|
|
|
|
glColor4f(0.0f, 0.0f, 0.0f, 0.33f);
|
|
|
|
glEnable(GL_BLEND);
|
2012-07-09 19:58:36 +00:00
|
|
|
uiRoundBox(rct->xmin - margin, rct->ymin - margin,
|
|
|
|
rct->xmax + margin, rct->ymax + margin, radius + margin);
|
2012-05-22 14:13:33 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-07 11:03:53 +00:00
|
|
|
static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
|
|
|
bNodeSocket *sock;
|
2012-07-09 19:58:36 +00:00
|
|
|
rctf *rct = &node->totr;
|
2011-02-21 13:47:49 +00:00
|
|
|
float iconofs;
|
2012-10-26 04:14:10 +00:00
|
|
|
/* float socket_size = NODE_SOCKSIZE*U.dpi/72; */ /* UNUSED */
|
2012-07-09 19:58:36 +00:00
|
|
|
float iconbutw = 0.8f * UI_UNIT_X;
|
|
|
|
int color_id = node_get_colorid(node);
|
2008-12-24 10:33:10 +00:00
|
|
|
char showname[128]; /* 128 used below */
|
|
|
|
View2D *v2d = &ar->v2d;
|
|
|
|
|
2010-06-14 07:02:11 +00:00
|
|
|
/* hurmf... another candidate for callback, have to see how this works first */
|
2012-07-09 19:58:36 +00:00
|
|
|
if (node->id && node->block && snode->treetype == NTREE_SHADER)
|
2010-06-14 07:02:11 +00:00
|
|
|
nodeShaderSynchronizeID(node, 0);
|
|
|
|
|
|
|
|
/* skip if out of view */
|
2012-08-05 20:40:26 +00:00
|
|
|
if (BLI_rctf_isect(&node->totr, &ar->v2d.cur, NULL) == FALSE) {
|
2010-06-14 07:02:11 +00:00
|
|
|
uiEndBlock(C, node->block);
|
2012-07-09 19:58:36 +00:00
|
|
|
node->block = NULL;
|
2010-06-14 07:02:11 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
/* shadow */
|
2012-06-01 14:42:21 +00:00
|
|
|
node_draw_shadow(snode, node, BASIS_RAD, 1.0f);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* header */
|
2012-07-09 19:58:36 +00:00
|
|
|
if (color_id == TH_NODE)
|
2008-12-24 10:33:10 +00:00
|
|
|
UI_ThemeColorShade(color_id, -20);
|
|
|
|
else
|
|
|
|
UI_ThemeColor(color_id);
|
2010-12-27 09:43:22 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_MUTED)
|
2011-11-11 13:09:14 +00:00
|
|
|
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
|
|
|
|
|
2012-07-17 10:19:47 +00:00
|
|
|
#ifdef WITH_COMPOSITOR
|
2012-07-09 19:58:36 +00:00
|
|
|
if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) {
|
2012-07-10 12:23:49 +00:00
|
|
|
if (COM_isHighlightedbNode(node)) {
|
2012-07-04 10:01:45 +00:00
|
|
|
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
|
|
|
|
}
|
|
|
|
}
|
2012-07-17 10:19:47 +00:00
|
|
|
#endif
|
|
|
|
|
2011-09-11 06:41:09 +00:00
|
|
|
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
|
2012-07-09 19:58:36 +00:00
|
|
|
uiRoundBox(rct->xmin, rct->ymax - NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2011-12-18 12:51:50 +00:00
|
|
|
/* show/hide icons */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
iconofs = rct->xmax - 0.35f * U.widget_unit;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2011-12-18 12:51:50 +00:00
|
|
|
/* preview */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->typeinfo->flag & NODE_PREVIEW) {
|
2011-12-18 12:51:50 +00:00
|
|
|
uiBut *but;
|
2012-07-09 19:58:36 +00:00
|
|
|
iconofs -= iconbutw;
|
2011-12-18 12:51:50 +00:00
|
|
|
uiBlockSetEmboss(node->block, UI_EMBOSSN);
|
|
|
|
but = uiDefIconBut(node->block, TOGBUT, B_REDR, ICON_MATERIAL,
|
2012-07-09 19:58:36 +00:00
|
|
|
iconofs, rct->ymax - NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
|
|
|
|
uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_preview_toggle");
|
2011-12-18 12:51:50 +00:00
|
|
|
/* XXX this does not work when node is activated and the operator called right afterwards,
|
|
|
|
* since active ID is not updated yet (needs to process the notifier).
|
|
|
|
* This can only work as visual indicator!
|
|
|
|
*/
|
|
|
|
// if (!(node->flag & (NODE_ACTIVE_ID|NODE_DO_OUTPUT)))
|
|
|
|
// uiButSetFlag(but, UI_BUT_DISABLED);
|
|
|
|
uiBlockSetEmboss(node->block, UI_EMBOSS);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2011-12-18 12:51:50 +00:00
|
|
|
/* group edit */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->type == NODE_GROUP) {
|
2011-12-18 12:51:50 +00:00
|
|
|
uiBut *but;
|
2012-07-09 19:58:36 +00:00
|
|
|
iconofs -= iconbutw;
|
2011-12-18 12:51:50 +00:00
|
|
|
uiBlockSetEmboss(node->block, UI_EMBOSSN);
|
|
|
|
but = uiDefIconBut(node->block, TOGBUT, B_REDR, ICON_NODETREE,
|
2012-07-09 19:58:36 +00:00
|
|
|
iconofs, rct->ymax - NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
|
|
|
|
uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_group_edit");
|
2011-12-18 12:51:50 +00:00
|
|
|
uiBlockSetEmboss(node->block, UI_EMBOSS);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* title */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & SELECT)
|
2012-05-22 14:13:33 +00:00
|
|
|
UI_ThemeColor(TH_SELECT);
|
2008-12-24 10:33:10 +00:00
|
|
|
else
|
|
|
|
UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
|
|
|
|
|
|
|
|
/* open/close entirely? */
|
2011-12-18 12:51:50 +00:00
|
|
|
{
|
|
|
|
uiBut *but;
|
2012-07-09 19:58:36 +00:00
|
|
|
int but_size = UI_UNIT_X * 0.6f;
|
2011-12-18 12:51:50 +00:00
|
|
|
/* XXX button uses a custom triangle draw below, so make it invisible without icon */
|
|
|
|
uiBlockSetEmboss(node->block, UI_EMBOSSN);
|
|
|
|
but = uiDefBut(node->block, TOGBUT, B_REDR, "",
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
rct->xmin + 0.5f * U.widget_unit - but_size / 2, rct->ymax - NODE_DY / 2.0f - but_size / 2,
|
2012-07-09 23:07:15 +00:00
|
|
|
but_size, but_size, NULL, 0, 0, 0, 0, "");
|
2012-07-09 19:58:36 +00:00
|
|
|
uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle");
|
2011-12-18 12:51:50 +00:00
|
|
|
uiBlockSetEmboss(node->block, UI_EMBOSS);
|
|
|
|
|
|
|
|
/* custom draw function for this button */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
UI_DrawTriIcon(rct->xmin + 0.5f * U.widget_unit, rct->ymax - NODE_DY / 2.0f, 'v');
|
2011-12-18 12:51:50 +00:00
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-03-03 16:31:46 +00:00
|
|
|
/* this isn't doing anything for the label, so commenting out */
|
|
|
|
#if 0
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & SELECT)
|
2008-12-24 10:33:10 +00:00
|
|
|
UI_ThemeColor(TH_TEXT_HI);
|
|
|
|
else
|
2012-03-03 16:31:46 +00:00
|
|
|
UI_ThemeColor(TH_TEXT);
|
|
|
|
#endif
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
|
|
|
|
|
2012-04-21 12:51:47 +00:00
|
|
|
//if (node->flag & NODE_MUTED)
|
2012-07-09 23:07:15 +00:00
|
|
|
// BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-07-09 17:05:47 +00:00
|
|
|
uiDefBut(node->block, LABEL, 0, showname,
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
(int)(rct->xmin + (NODE_MARGIN_X)), (int)(rct->ymax - NODE_DY),
|
2012-07-09 17:05:47 +00:00
|
|
|
(short)(iconofs - rct->xmin - 18.0f), (short)NODE_DY,
|
|
|
|
NULL, 0, 0, 0, 0, "");
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* body */
|
2012-05-22 14:13:33 +00:00
|
|
|
if (node->flag & NODE_CUSTOM_COLOR)
|
|
|
|
glColor3fv(node->color);
|
|
|
|
else
|
|
|
|
UI_ThemeColor4(TH_NODE);
|
2008-12-24 10:33:10 +00:00
|
|
|
glEnable(GL_BLEND);
|
2012-05-22 14:13:33 +00:00
|
|
|
uiSetRoundBox(UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT);
|
2012-07-09 19:58:36 +00:00
|
|
|
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax - NODE_DY, BASIS_RAD);
|
2008-12-24 10:33:10 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
2011-01-09 18:59:35 +00:00
|
|
|
/* outline active and selected emphasis */
|
2012-08-01 09:44:25 +00:00
|
|
|
if (node->flag & SELECT) {
|
2008-12-24 10:33:10 +00:00
|
|
|
glEnable(GL_BLEND);
|
2012-04-29 17:11:40 +00:00
|
|
|
glEnable(GL_LINE_SMOOTH);
|
2012-05-22 14:13:33 +00:00
|
|
|
|
|
|
|
if (node->flag & NODE_ACTIVE)
|
|
|
|
UI_ThemeColorShadeAlpha(TH_ACTIVE, 0, -40);
|
|
|
|
else
|
|
|
|
UI_ThemeColorShadeAlpha(TH_SELECT, 0, -40);
|
|
|
|
uiSetRoundBox(UI_CNR_ALL);
|
|
|
|
uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD);
|
|
|
|
|
2012-04-29 17:11:40 +00:00
|
|
|
glDisable(GL_LINE_SMOOTH);
|
2008-12-24 10:33:10 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* disable lines */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_MUTED)
|
2008-12-24 10:33:10 +00:00
|
|
|
node_draw_mute_line(v2d, snode, node);
|
|
|
|
|
|
|
|
|
|
|
|
/* socket inputs, buttons */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (sock = node->inputs.first; sock; sock = sock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (nodeSocketIsHidden(sock))
|
2011-09-05 21:01:50 +00:00
|
|
|
continue;
|
|
|
|
|
2012-06-01 12:38:03 +00:00
|
|
|
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE, sock->flag & SELECT);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2012-05-02 07:18:51 +00:00
|
|
|
node->typeinfo->drawinputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name),
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
sock->locx + (NODE_DYS), sock->locy - NODE_DYS,
|
|
|
|
NODE_WIDTH(node) - NODE_DY);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* socket outputs */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (sock = node->outputs.first; sock; sock = sock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (nodeSocketIsHidden(sock))
|
2011-09-05 21:01:50 +00:00
|
|
|
continue;
|
|
|
|
|
2012-06-01 12:38:03 +00:00
|
|
|
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE, sock->flag & SELECT);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2012-05-02 07:18:51 +00:00
|
|
|
node->typeinfo->drawoutputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name),
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
sock->locx - NODE_WIDTH(node) + (NODE_DYS), sock->locy - NODE_DYS,
|
|
|
|
NODE_WIDTH(node) - NODE_DY);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* preview */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_PREVIEW) {
|
|
|
|
if (node->preview && node->preview->rect && !BLI_rctf_is_empty(&node->prvr))
|
2008-12-24 10:33:10 +00:00
|
|
|
node_draw_preview(node->preview, &node->prvr);
|
2009-09-30 18:18:32 +00:00
|
|
|
}
|
2010-04-06 09:05:00 +00:00
|
|
|
|
|
|
|
UI_ThemeClearColor(color_id);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2009-09-16 18:59:13 +00:00
|
|
|
uiEndBlock(C, node->block);
|
|
|
|
uiDrawBlock(C, node->block);
|
2012-07-09 19:58:36 +00:00
|
|
|
node->block = NULL;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
2012-07-04 10:01:45 +00:00
|
|
|
static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
|
|
|
bNodeSocket *sock;
|
2012-07-09 19:58:36 +00:00
|
|
|
rctf *rct = &node->totr;
|
2012-09-15 11:48:20 +00:00
|
|
|
float dx, centy = BLI_rctf_cent_y(rct);
|
|
|
|
float hiddenrad = BLI_rctf_size_y(rct) / 2.0f;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
float socket_size = NODE_SOCKSIZE;
|
2012-07-09 19:58:36 +00:00
|
|
|
int color_id = node_get_colorid(node);
|
|
|
|
char showname[128]; /* 128 is used below */
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* shadow */
|
2012-06-01 14:42:21 +00:00
|
|
|
node_draw_shadow(snode, node, hiddenrad, 1.0f);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* body */
|
2011-01-09 18:59:35 +00:00
|
|
|
UI_ThemeColor(color_id);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_MUTED)
|
2011-11-11 13:09:14 +00:00
|
|
|
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
|
2012-07-04 10:01:45 +00:00
|
|
|
|
2012-07-17 10:19:47 +00:00
|
|
|
#ifdef WITH_COMPOSITOR
|
2012-07-09 19:58:36 +00:00
|
|
|
if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) {
|
2012-07-10 12:23:49 +00:00
|
|
|
if (COM_isHighlightedbNode(node)) {
|
2012-07-04 10:01:45 +00:00
|
|
|
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
|
|
|
|
}
|
|
|
|
}
|
2012-07-17 10:19:47 +00:00
|
|
|
#else
|
|
|
|
(void)ntree;
|
|
|
|
#endif
|
2012-07-04 10:01:45 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
|
|
|
|
|
2011-01-09 18:59:35 +00:00
|
|
|
/* outline active and selected emphasis */
|
2012-08-03 11:39:34 +00:00
|
|
|
if (node->flag & SELECT) {
|
2008-12-24 10:33:10 +00:00
|
|
|
glEnable(GL_BLEND);
|
2012-04-29 17:11:40 +00:00
|
|
|
glEnable(GL_LINE_SMOOTH);
|
2012-05-22 14:13:33 +00:00
|
|
|
|
|
|
|
if (node->flag & NODE_ACTIVE)
|
|
|
|
UI_ThemeColorShadeAlpha(TH_ACTIVE, 0, -40);
|
|
|
|
else
|
|
|
|
UI_ThemeColorShadeAlpha(TH_SELECT, 0, -40);
|
|
|
|
uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
|
|
|
|
|
2012-04-29 17:11:40 +00:00
|
|
|
glDisable(GL_LINE_SMOOTH);
|
2008-12-24 10:33:10 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* title */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & SELECT)
|
2012-05-22 14:13:33 +00:00
|
|
|
UI_ThemeColor(TH_SELECT);
|
2008-12-24 10:33:10 +00:00
|
|
|
else
|
|
|
|
UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
|
|
|
|
|
|
|
|
/* open entirely icon */
|
2011-12-18 12:51:50 +00:00
|
|
|
{
|
|
|
|
uiBut *but;
|
2012-07-09 19:58:36 +00:00
|
|
|
int but_size = UI_UNIT_X * 0.6f;
|
2011-12-18 12:51:50 +00:00
|
|
|
/* XXX button uses a custom triangle draw below, so make it invisible without icon */
|
|
|
|
uiBlockSetEmboss(node->block, UI_EMBOSSN);
|
|
|
|
but = uiDefBut(node->block, TOGBUT, B_REDR, "",
|
2012-07-09 23:07:15 +00:00
|
|
|
rct->xmin + 10.0f - but_size / 2, centy - but_size / 2,
|
|
|
|
but_size, but_size, NULL, 0, 0, 0, 0, "");
|
2012-07-09 19:58:36 +00:00
|
|
|
uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle");
|
2011-12-18 12:51:50 +00:00
|
|
|
uiBlockSetEmboss(node->block, UI_EMBOSS);
|
|
|
|
|
|
|
|
/* custom draw function for this button */
|
2012-07-09 19:58:36 +00:00
|
|
|
UI_DrawTriIcon(rct->xmin + 10.0f, centy, 'h');
|
2011-12-18 12:51:50 +00:00
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* disable lines */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_MUTED)
|
2012-10-21 05:46:41 +00:00
|
|
|
node_draw_mute_line(&ar->v2d, snode, node);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & SELECT)
|
2012-05-22 14:13:33 +00:00
|
|
|
UI_ThemeColor(TH_SELECT);
|
2008-12-24 10:33:10 +00:00
|
|
|
else
|
|
|
|
UI_ThemeColor(TH_TEXT);
|
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
if (node->miniwidth > 0.0f) {
|
2011-09-05 21:01:50 +00:00
|
|
|
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
|
2011-02-08 12:54:32 +00:00
|
|
|
|
2012-04-21 12:51:47 +00:00
|
|
|
//if (node->flag & NODE_MUTED)
|
2012-07-09 23:07:15 +00:00
|
|
|
// BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-07-09 17:05:47 +00:00
|
|
|
uiDefBut(node->block, LABEL, 0, showname,
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
(int)(rct->xmin + (NODE_MARGIN_X)), (int)(centy - 10),
|
2012-09-15 11:48:20 +00:00
|
|
|
(short)(BLI_rctf_size_x(rct) - 18.0f - 12.0f), (short)NODE_DY,
|
2012-07-09 17:05:47 +00:00
|
|
|
NULL, 0, 0, 0, 0, "");
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* scale widget thing */
|
2012-07-09 19:58:36 +00:00
|
|
|
UI_ThemeColorShade(color_id, -10);
|
|
|
|
dx = 10.0f;
|
|
|
|
fdrawline(rct->xmax - dx, centy - 4.0f, rct->xmax - dx, centy + 4.0f);
|
|
|
|
fdrawline(rct->xmax - dx - 3.0f * snode->aspect, centy - 4.0f, rct->xmax - dx - 3.0f * snode->aspect, centy + 4.0f);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
UI_ThemeColorShade(color_id, +30);
|
2012-07-09 19:58:36 +00:00
|
|
|
dx -= snode->aspect;
|
|
|
|
fdrawline(rct->xmax - dx, centy - 4.0f, rct->xmax - dx, centy + 4.0f);
|
|
|
|
fdrawline(rct->xmax - dx - 3.0f * snode->aspect, centy - 4.0f, rct->xmax - dx - 3.0f * snode->aspect, centy + 4.0f);
|
2012-06-01 12:38:03 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* sockets */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (sock = node->inputs.first; sock; sock = sock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodeSocketIsHidden(sock))
|
2012-06-01 12:38:03 +00:00
|
|
|
node_socket_circle_draw(snode->nodetree, sock, socket_size, sock->flag & SELECT);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
for (sock = node->outputs.first; sock; sock = sock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodeSocketIsHidden(sock))
|
2012-06-01 12:38:03 +00:00
|
|
|
node_socket_circle_draw(snode->nodetree, sock, socket_size, sock->flag & SELECT);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2009-04-20 12:03:55 +00:00
|
|
|
|
2009-09-16 18:59:13 +00:00
|
|
|
uiEndBlock(C, node->block);
|
|
|
|
uiDrawBlock(C, node->block);
|
2012-07-09 19:58:36 +00:00
|
|
|
node->block = NULL;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
int node_get_resize_cursor(int directions)
|
|
|
|
{
|
2012-07-09 19:58:36 +00:00
|
|
|
if (directions == 0)
|
2012-05-22 14:13:33 +00:00
|
|
|
return CURSOR_STD;
|
2012-07-09 19:58:36 +00:00
|
|
|
else if ((directions & ~(NODE_RESIZE_TOP | NODE_RESIZE_BOTTOM)) == 0)
|
2012-05-22 14:13:33 +00:00
|
|
|
return CURSOR_Y_MOVE;
|
2012-07-09 19:58:36 +00:00
|
|
|
else if ((directions & ~(NODE_RESIZE_RIGHT | NODE_RESIZE_LEFT)) == 0)
|
2012-05-22 14:13:33 +00:00
|
|
|
return CURSOR_X_MOVE;
|
|
|
|
else
|
|
|
|
return CURSOR_EDIT;
|
|
|
|
}
|
|
|
|
|
|
|
|
void node_set_cursor(wmWindow *win, SpaceNode *snode)
|
|
|
|
{
|
|
|
|
bNodeTree *ntree = snode->edittree;
|
|
|
|
bNode *node;
|
|
|
|
bNodeSocket *sock;
|
|
|
|
int cursor = CURSOR_STD;
|
|
|
|
|
|
|
|
if (ntree) {
|
2012-07-09 19:58:36 +00:00
|
|
|
if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN | SOCK_OUT)) {
|
2012-05-22 14:13:33 +00:00
|
|
|
/* pass */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* check nodes front to back */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (node = ntree->nodes.last; node; node = node->prev) {
|
2012-08-23 18:25:45 +00:00
|
|
|
if (BLI_rctf_isect_pt(&node->totr, snode->cursor[0], snode->cursor[1]))
|
2012-07-09 19:58:36 +00:00
|
|
|
break; /* first hit on node stops */
|
2012-05-22 14:13:33 +00:00
|
|
|
}
|
|
|
|
if (node) {
|
2012-08-08 17:37:02 +00:00
|
|
|
int dir = node->typeinfo->resize_area_func(node, snode->cursor[0], snode->cursor[1]);
|
2012-05-22 14:13:33 +00:00
|
|
|
cursor = node_get_resize_cursor(dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WM_cursor_set(win, cursor);
|
|
|
|
}
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
void node_draw_default(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_HIDDEN)
|
2012-07-04 10:01:45 +00:00
|
|
|
node_draw_hidden(C, ar, snode, ntree, node);
|
2011-09-05 21:01:50 +00:00
|
|
|
else
|
|
|
|
node_draw_basis(C, ar, snode, ntree, node);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void node_update(const bContext *C, bNodeTree *ntree, bNode *node)
|
|
|
|
{
|
|
|
|
if (node->typeinfo->drawupdatefunc)
|
|
|
|
node->typeinfo->drawupdatefunc(C, ntree, node);
|
|
|
|
}
|
|
|
|
|
|
|
|
void node_update_nodetree(const bContext *C, bNodeTree *ntree, float offsetx, float offsety)
|
|
|
|
{
|
|
|
|
bNode *node;
|
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
/* update nodes front to back, so children sizes get updated before parents */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (node = ntree->nodes.last; node; node = node->prev) {
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* XXX little hack (not used anyore?) */
|
2011-09-05 21:01:50 +00:00
|
|
|
node->locx += offsetx;
|
|
|
|
node->locy += offsety;
|
|
|
|
|
|
|
|
node_update(C, ntree, node);
|
|
|
|
|
|
|
|
node->locx -= offsetx;
|
|
|
|
node->locy -= offsety;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void node_draw(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
|
|
|
|
{
|
|
|
|
if (node->typeinfo->drawfunc)
|
|
|
|
node->typeinfo->drawfunc(C, ar, snode, ntree, node);
|
|
|
|
}
|
|
|
|
|
2012-08-12 19:35:47 +00:00
|
|
|
#define USE_DRAW_TOT_UPDATE
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
|
|
|
bNode *node;
|
|
|
|
bNodeLink *link;
|
|
|
|
int a;
|
|
|
|
|
2012-07-09 19:58:36 +00:00
|
|
|
if (ntree == NULL) return; /* groups... */
|
2012-08-12 19:35:47 +00:00
|
|
|
|
|
|
|
#ifdef USE_DRAW_TOT_UPDATE
|
|
|
|
if (ntree->nodes.first) {
|
|
|
|
BLI_rctf_init_minmax(&ar->v2d.tot);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
/* draw background nodes, last nodes in front */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
|
2012-08-12 19:35:47 +00:00
|
|
|
|
|
|
|
#ifdef USE_DRAW_TOT_UPDATE
|
|
|
|
/* unrelated to background nodes, update the v2d->tot,
|
|
|
|
* can be anywhere before we draw the scroll bars */
|
|
|
|
BLI_rctf_union(&ar->v2d.tot, &node->totr);
|
|
|
|
#endif
|
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
if (!(node->flag & NODE_BACKGROUND))
|
|
|
|
continue;
|
2012-07-09 19:58:36 +00:00
|
|
|
node->nr = a; /* index of node in list, used for exec event code */
|
2012-05-22 14:13:33 +00:00
|
|
|
node_draw(C, ar, snode, ntree, node);
|
|
|
|
}
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* node lines */
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glEnable(GL_LINE_SMOOTH);
|
2012-07-09 19:58:36 +00:00
|
|
|
for (link = ntree->links.first; link; link = link->next)
|
2008-12-24 10:33:10 +00:00
|
|
|
node_draw_link(&ar->v2d, snode, link);
|
|
|
|
glDisable(GL_LINE_SMOOTH);
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
/* draw foreground nodes, last nodes in front */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
|
2012-05-22 14:13:33 +00:00
|
|
|
if (node->flag & NODE_BACKGROUND)
|
|
|
|
continue;
|
2012-07-09 19:58:36 +00:00
|
|
|
node->nr = a; /* index of node in list, used for exec event code */
|
2011-09-05 21:01:50 +00:00
|
|
|
node_draw(C, ar, snode, ntree, node);
|
2011-02-21 13:47:49 +00:00
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
|
|
|
|
{
|
|
|
|
View2DScrollers *scrollers;
|
2012-07-09 19:58:36 +00:00
|
|
|
SpaceNode *snode = CTX_wm_space_node(C);
|
2011-03-25 16:53:07 +00:00
|
|
|
bNodeLinkDrag *nldrag;
|
2012-05-15 12:40:43 +00:00
|
|
|
LinkData *linkdata;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2010-04-06 07:02:16 +00:00
|
|
|
UI_ThemeClearColor(TH_BACK);
|
2008-12-24 10:33:10 +00:00
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
|
2010-10-14 01:22:14 +00:00
|
|
|
UI_view2d_view_ortho(v2d);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
//uiFreeBlocksWin(&sa->uiblocks, sa->win);
|
|
|
|
|
2012-06-29 14:34:46 +00:00
|
|
|
ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* only set once */
|
2012-04-29 17:11:40 +00:00
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
2008-12-24 10:33:10 +00:00
|
|
|
glEnable(GL_MAP1_VERTEX_3);
|
|
|
|
|
|
|
|
/* aspect+font, set each time */
|
2012-09-15 11:48:20 +00:00
|
|
|
snode->aspect = BLI_rctf_size_x(&v2d->cur) / (float)ar->winx;
|
2012-10-26 04:14:10 +00:00
|
|
|
// XXX snode->curfont = uiSetCurFont_ext(snode->aspect);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-06-28 08:47:22 +00:00
|
|
|
/* grid */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
UI_view2d_multi_grid_draw(v2d, U.widget_unit, 5, 2);
|
2012-06-28 08:47:22 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* backdrop */
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
draw_nodespace_back_pix(C, ar, snode);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* nodes */
|
|
|
|
snode_set_context(snode, CTX_data_scene(C));
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (snode->nodetree) {
|
2008-12-24 10:33:10 +00:00
|
|
|
bNode *node;
|
2012-07-10 12:42:03 +00:00
|
|
|
/* void** highlights = 0; */ /* UNUSED */
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2011-11-24 09:26:19 +00:00
|
|
|
node_uiblocks_init(C, snode->nodetree);
|
|
|
|
|
|
|
|
/* uiBlocks must be initialized in drawing order for correct event clipping.
|
|
|
|
* Node group internal blocks added after the main group block.
|
|
|
|
*/
|
2012-07-09 19:58:36 +00:00
|
|
|
for (node = snode->nodetree->nodes.first; node; node = node->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_GROUP_EDIT)
|
2010-03-29 07:15:12 +00:00
|
|
|
node_uiblocks_init(C, (bNodeTree *)node->id);
|
|
|
|
}
|
2010-01-12 07:07:51 +00:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
node_update_nodetree(C, snode->nodetree, 0.0f, 0.0f);
|
2012-07-17 10:19:47 +00:00
|
|
|
|
|
|
|
#ifdef WITH_COMPOSITOR
|
2012-07-10 12:23:49 +00:00
|
|
|
if (snode->nodetree->type == NTREE_COMPOSIT) {
|
|
|
|
COM_startReadHighlights();
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2012-07-17 10:19:47 +00:00
|
|
|
#endif
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
node_draw_nodetree(C, ar, snode, snode->nodetree);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
#if 0
|
2008-12-24 10:33:10 +00:00
|
|
|
/* active group */
|
2012-07-09 19:58:36 +00:00
|
|
|
for (node = snode->nodetree->nodes.first; node; node = node->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_GROUP_EDIT)
|
2011-02-08 12:54:32 +00:00
|
|
|
node_draw_group(C, ar, snode, snode->nodetree, node);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
#endif
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
2011-03-25 16:53:07 +00:00
|
|
|
/* temporary links */
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glEnable(GL_LINE_SMOOTH);
|
2012-07-09 19:58:36 +00:00
|
|
|
for (nldrag = snode->linkdrag.first; nldrag; nldrag = nldrag->next) {
|
|
|
|
for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) {
|
2012-05-15 12:40:43 +00:00
|
|
|
node_draw_link(&ar->v2d, snode, (bNodeLink *)linkdata->data);
|
2012-07-09 19:58:36 +00:00
|
|
|
}
|
2012-05-15 12:40:43 +00:00
|
|
|
}
|
2011-03-25 16:53:07 +00:00
|
|
|
glDisable(GL_LINE_SMOOTH);
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
2012-06-29 14:34:46 +00:00
|
|
|
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
|
|
|
|
|
2012-12-17 02:34:53 +00:00
|
|
|
if (snode->flag & SNODE_SHOW_GPENCIL) {
|
|
|
|
/* draw grease-pencil ('canvas' strokes) */
|
|
|
|
if (snode->nodetree) {
|
|
|
|
draw_gpencil_view2d(C, TRUE);
|
|
|
|
}
|
|
|
|
}
|
2008-12-26 20:39:29 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* reset view matrix */
|
|
|
|
UI_view2d_view_restore(C);
|
|
|
|
|
2012-12-17 02:34:53 +00:00
|
|
|
if (snode->flag & SNODE_SHOW_GPENCIL) {
|
|
|
|
/* draw grease-pencil (screen strokes, and also paintbuffer) */
|
|
|
|
if (snode->nodetree) {
|
|
|
|
draw_gpencil_view2d(C, FALSE);
|
|
|
|
}
|
|
|
|
}
|
2009-11-11 08:12:54 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* scrollers */
|
2012-07-09 19:58:36 +00:00
|
|
|
scrollers = UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
|
2008-12-24 10:33:10 +00:00
|
|
|
UI_view2d_scrollers_draw(C, v2d, scrollers);
|
|
|
|
UI_view2d_scrollers_free(scrollers);
|
2008-12-26 13:11:04 +00:00
|
|
|
}
|