Commit Graph

133 Commits

Author SHA1 Message Date
Ken Hughes
b8e425af7c Revisions to previous change of new_id().
Note: the intent of the original modification (and these updates) is not to
change how new_id() functions.  What has been done is to pull out the code
which calculates a new name for an ID in the case of duplicate, as would
happen when you copy any datablock, into a separate function.  This code is
necessary in the new Python Library module, since it otherwise is extremely
difficult to locate a new datablock appended from a library.  new_id() calls
this separate function to generate a name for the new ID if necessary, just
as it previously did.

To make the purpose of this new function clearer, I renamed it
check_for_dupid() and added more extensive comments.  I repeat, it's not
meant to be a substitute for new_id().
2007-03-29 04:55:29 +00:00
d1315a342d Bugfix: function new_id() was allowed to be called with NULL.
Caused by Ken Hughes commit of 5 days ago

Note; dup_id() will go away, is not according to Blender spec.
2007-03-26 13:02:43 +00:00
Ken Hughes
3a834803ef Python API
----------
Support for new bpy.libraries module, which is being proposed to replace
the Blender.Library module.
2007-03-21 02:23:28 +00:00
d473b4b17d Plumiferos-reported Proxy bug:
Appending a scene (i.e. "make local") didn't set the correct library
tag in linked proxy. That caused file saving to ignore the proxy object.
2007-01-25 11:59:29 +00:00
634fe56fbe Bugfix #5316
Order of freeing of Blender database is important, but the past year(s)
new database entries were added in wrong places, so freeing could go in
wrong order. In this case it was Groups being freed before Objects. But
there are more errors...

It only shows really in Windows, since it's the OS that is sensitive for
writing data in freed memory. For other OSes it doesn't make Blender more
stable, only mem-frees happened, no mem-allocs.
2007-01-18 15:23:28 +00:00
253432bfc7 The Big Image refactor!
Please read:
http://www.blender3d.org/cms/Imaging.834.0.html

Or in short:

- adding MultiLayer Image support
- recoded entire Image API
- better integration of movie/sequence Images

Was a whole load of work... went down for a week to do this. So, will need
a lot of testing! Will be in irc all evening.
2006-12-20 17:57:56 +00:00
20ac94e8f0 Two hours of fixing details based on Klocwork source review. Useful report,
although it has a lot of noise. Not to mention our bad string code gives
a load of warnings.

I've reviewed specifically:
- file reading/write
- dna and library code
- node system
- entire render module

Done a couple of files in src/ too, seemed to be nice errors.
2006-12-01 19:52:04 +00:00
eb03a578a3 New feature: Face Duplicators. Like vertex-duplicator, but now on a face
center, rotated according to face edges, and optionally with scale of the
face.

http://www.blender3d.org/cms/Face_Duplicator.828.0.html

Also: bugfix in undo/redo for relinking data to the UI. It was not checking
for Library data, accidentally linking non-library data with same names.
2006-11-29 08:57:32 +00:00
604b423032 - Library linking feature: global undo/redo now doesn't read the linked
library .blend files anymore, making it a load faster to use.

- Fixed ancient annoyance; samples were not properly freed, giving a lot
  "Error Totblock" when using sound.
  This fix also involves removing an ancient NaN hack, which treated the
  samples as fake Library data in the Main database.
  But still, the Blender Sound and Sample code is horrible... :/
2006-11-25 13:07:28 +00:00
8768707610 =ID Properties=
This commit adds supports for per-ID properties to blender.
See http://mediawiki.blender.org/index.php/BlenderDev/ID_Property
for more information on how it all works.

ID properties are accesable by python; but note that 
bindings have only been added to Object and Material thus
far.  However adding more bindings is easy and I plan
on adding several more hopefully within an hour of this inital 
commit.

A generic UI panel is also planned, that will go wherever its
needed; for example in the material buttons, editing buttons, etc.
I'll likely submit the initial code for that as a patch, though,
so matt and ton and others can go over it and make sure it's
all good. :)

VERY important, if you intend to use ID properties please
go to http://mediawiki.blender.org/index.php/BlenderDev/PropertyStandards
and start writing the appropriate standards for it.
2006-11-17 04:46:48 +00:00
02baf30e55 New feature: imporant missing option for use of Libraries: access to to the
file path where library is read from.

In Outliner, choose new view mode "Libraries". A ctrl+click on the library
name then allows to change the file name or path. Note that when you change
the file name, nothing is being re-read or re-linked. Only after saving the
.blend file and reading it back the new library is used.

This feature allows to cleanup library usage. You can make files relative,
or reorganize a project. Just keep in mind that you cannot use this feature
to fix .blend files that link to non-existing other files. That because the
lost data is actually not read at all, so cannot be saved either.

Currently, library errors are only printed in the console... quite
important to keep track of when using Libraries.

Implementation note: this Outliner view mode can become expanded to a full
"Database view", showing something similar as SHIFT+F4 databrowse does now.
2006-09-06 09:51:30 +00:00
4ee3515bf1 Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
  to be used in texture paint, vertex paint, weight paint and sculpt
  mode also.
- Being a datablock, these brushes can be saved, appended and linked.
  They have a fake user by default, to make sure they are saved even if
  not selected.

Image Painting:

- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
  be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
  added, code taken directly from vertex paint.

Note to project files maintainers:

- The img module was removed from SCons and Makefiles, and this should
  be done in other build systems also. I'll wait to remove the module
  from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
46110ec06b Bugfix: (own todo)
When you rename a generated image, like "Render Result" or "Composite"
the float buffer in this image had to be copied, otherwise a next render
will make the renamed Image buffer invalid.

Note that renaming will not mean the images get packed or saved! So on
reloading .blend they're gone.
2006-07-07 17:08:04 +00:00
fd1d3779d0 Fix for appending data from other files: if this appended data
again was linking from another file, this relationship was not
corrected (lib_indirect -> lib_extern), so also not saved in a file.
2006-03-05 17:35:06 +00:00
5e3d30c276 Feature:
- Appending Images now re-assigns relative paths, to match with the file
  as currently being used

Bugfix:
- Memory error in creating preview render rects... gave no issues here,
  but i guess that's not saying anything! Hope its more stable now. :)
2006-02-09 19:47:53 +00:00
ea7538dca6 Orange: more noodle updates!
**** NEW: Group Nodes

Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.

This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)

So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.

Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).

What works now:

- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.

- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.

- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.

- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.

What needs to be done:

- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.


**** NEW: Socket Visibility control

Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.

A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).

Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.

To be done:
- a way to hide individual sockets, like with a RMB click on it.

**** NEW: Nodes now render!

This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.

What needs to be done:

- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
  shadow value, or light intensity only, etc

Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.

Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.

OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
8d35213990 More node goodies!
First note; this is a WIP project, some commits might change things that
make formerly saved situations not to work identically... like now!

------ New Material integration ------

Until now, the Node system worked on top of the 'current' Material, just
like how the Material Layers worked. That's quite confusing in practice,
especially to see what Material is a Node, or what is the "base material"

Best solution is to completely separate the two. This has been implemented
as follows now;

- The confusing "Input" node has been removed.
- When choosing a Material in Blender, you can define this Material to be
  either 'normal' (default) or be the root of a Node tree.
- If a Material is a Node tree, you have to add Nodes in the tree to see
  something happen. An empty Node tree doesn't do anything (black).
- If a Material is a Node Tree, the 'data browse' menus show it with an
  'N' mark before the name. The 'data block' buttons display it with the
  suffix 'NT' (instead of 'MA').
- In a Node Tree, any Material can be inserted, including itself. Only in
  that case the Material is being used itself for shading.

UI changes:

Added a new Panel "Links", which shows:
- where the Material is linked to (Object, Mesh, etc)
- if the Material is a NodeTree or not
- the actual active Material in the Tree

The "Node" Panel itself now only shows buttons from the other nodes, when
they are active.

Further the Material Nodes themselves allow browsing and renaming or adding
new Materials now too.

Second half of today's work was cleaning up selection when the Nodes
overlap... it was possible to drag links from invisible sockets, or click
headers for invisible nodes, etc. This because the mouse input code was
not checking for visibility yet.
Works now even for buttons. :)
2005-12-29 18:08:01 +00:00
80eb4d3b9e Big commit in orange: Interface icons for materials, textures
world and lamp. Also for images in pupmenus.
Also preparation for work on using preview images in imagebrowser.

-- Andrea
2005-12-21 22:21:43 +00:00
46c18b3e95 NLA editor, adding actions wasn't possible when amount of actions was over
30, the databrowse option didnt work.

Made popup menu to go to 60 now, in 3 collums max. Databrowse works too
now.

Next commit; check all other databrowsers for it.
2005-12-12 16:29:47 +00:00
d7ed26e3c6 Deleting Effectors (deflectors or Fields) now update particle systems and
softbody. (report #3385)
2005-11-11 10:46:26 +00:00
1b466f7765 Hide .file blocks in databrowse/pop menu.
This is mainly useful for scripts that generate/load datablocks for their own use and don't want to burry the user under an avalanche of datablocks he/she doesn't care about.

This adds a user pref "Hide .data" which now acts as a default value when opening a new fileselector.
It is also used when creating data select pop menus.

The "ghost" button in a fileselect window is independant from the userpref. It can be turned on/off individually without affecting

Note: When turning the option on/off, it sometimes take a couple of times before the pop menu registers it. Probably some caching thing. Will have to look at it.

Default value is Off.
2005-07-11 23:49:06 +00:00
28a1e8277b Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs

A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;

- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes

Armatures;

Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!

Important to note is;

1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.

- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.

TODO NOW;

- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.

TODO LATER;

We now can do loadsa new nifty features as well; like:

- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...


Bugfixes;

- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change

-Ton-
2005-07-03 17:35:38 +00:00
24c9f65056 - got tired of str[n]casecmp not declared warnings
- added BLI_str[n]casecmp, use instead of regular versions
 - rewrote BLI_str[n]casecmp to not be stupid
2005-04-02 15:36:57 +00:00
8e92ee8684 - remove all obsolete inclusions of BLI_winstuff.h (due to recent changes)
NOTE: BLI_winstuff.h was meant to be a wrapper around windows.h to handle
undefining various crap that windows.h defines. Platform specific headers
should only have to be included in a few places. This reduces the number
of inclusions of BLI_winstuff.h to 16 which is a much more reasonable
number (than the 144 or whatever it used to be)
2005-03-19 21:08:13 +00:00
438331af8e Nasty Library linking and appending stuff!
Problem: when appending data, it called the local_all() function, which
indeed made all data local, including all other dynamic linked data.
Not very nice... but mixing dynamic & appending data from single file is
headcrunching code.

Solution: when appending data, it now only makes local_all() the data from
that specific library file, leaving dynamic data from other files linked.

(Bug report 1183)
2004-04-22 19:58:54 +00:00
c8cadcd557 Bug 729
When more than 30 scenes are in a scene, the sequencer "Add" option didnt
show a databrowse window.
This was a nasty one, because databrowse facilities are more-of tied to
having a header. The fix is that I added option to IDnames_to_pupstring()
to not limit the menu (by passing NULL for menu short pointer).

Also noticed a bug with pupmenu_col(), which did return on a val==0 event
(mouse release) which shouldn't be, this makes sequences of menus not
possible.
2004-04-10 15:13:28 +00:00
1652884463 BPython:
-- removed struct Script (DNA_script_types.h) from makesdna to blender/include/BPI_script.h
   (BPI meaning Blender Python-related external Include file).
   Had agreed with Ton that makesdna was not the proper place for it.
-- fixed two small warnings in Ipo.c (variables might be used uninitialized)
-- fixed a bug reported on blender.org's python forum by Wim Van Hoydonck (aka tuinbels):
   Blender would hang if a script failed.  My fault, accidentally put a node=node->next type call outside the while loop check, so it never ended.

With makesdna/DNA_script_types.h removed and include/BPI_script.h added, msvc projectfiles will need to be updated.  Sorry to do it now, but I promissed I'd fix this before next release.
2004-01-21 04:38:03 +00:00
ec99255c27 Phew, a lot of work, and no new features...
Main target was to make the inner rendering loop using no globals anymore.
This is essential for proper usage while raytracing, it caused a lot of
hacks in the raycode as well, which even didn't work correctly for all
situations (textures especially).

Done this by creating a new local struct RenderInput, which replaces usage
of the global struct Render R. The latter now only is used to denote
image size, viewmatrix, and the like.

Making the inner render loops using no globals caused 1000s of vars to
be changed... but the result definitely is much nicer code, which enables
making 'real' shaders in a next stage.
It also enabled me to remove the hacks from ray.c

Then i went to the task of removing redundant code. Especially the calculus
of texture coords took place (identical) in three locations.
Most obvious is the change in the unified render part, which is much less
code now; it uses the same rendering routines as normal render now.
(Note; not for halos yet!)

I also removed 6 files called 'shadowbuffer' something. This was experimen-
tal stuff from NaN days. And again saved a lot of double used code.

Finally I went over the blenkernel and blender/src calls to render stuff.
Here the same local data is used now, resulting in less dependency.
I also moved render-texture to the render module, this was still in Kernel.
(new file: texture.c)

So! After this commit I will check on the autofiles, to try to fix that.
MSVC people have to do it themselves.
This commit will need quite some testing help, but I'm around!
2003-12-21 21:52:51 +00:00
49021f7ec4 BPython - first step for better integration of Python in Blender:
- add a new space: Space Script
- add a new dna struct: Script
- add these two properly everywhere they are meant to

It's not a tiny commit, but most of it is ground work for what is still to be done.
Right now the benefits should be: freeing the Text Editor to be used in a window even while a script w/ gui in "on" and letting more than one currently running script w/ gui be accessible from each window

Some files are added, so some build systems (not autotools) will need updates
2003-12-14 01:18:09 +00:00
513ae61f2b First commit of a new toolbox system.
Aim was to find a simple & easy system, script alike, to add and configure
a toolbox system, so that others can experiment, but also of course Python.

Summary:
- spacebar calls it up. SHIFT+A still does old toolbox
- hold left or rightmouse for 0.4 second, and it pops up as well
  this is experimental! Can be tweaked with Userdef var "ThresA"
- it is a little bit complete for Object mode only. Needs still work
  at information desing/structure level
- the code works like an engine, interpreting structs like this:

static TBitem addmenu_curve[]= {
{	0, "Bezier Curve", 	0, NULL},
{	0, "Bezier Circle", 1, NULL},
{	0, "NURBS Curve", 	2, NULL},
{	0, "NURBS Circle", 	3, NULL},
{	0, "Path", 			4, NULL},
{  -1, "", 			0, do_info_add_curvemenu}};

- first value is ICON code,
- then name
- return value
- pointer to optional child

last row has -1 to indicate its the last...
plus a callback to event function.

I also built an old toolbox style callback for this:

static TBitem tb_object_select[]= {
{	0, "Border Select|B", 	'b', NULL},
{	0, "(De)select All|A", 	'a', NULL},
{	0, "Linked...|Shift L", 	'L', NULL},
{	0, "Grouped...|Shift G", 	'G', NULL},
{  -1, "", 			0, tb_do_hotkey}};

here the return values are put back as hotkeys in mainqueue.

A mainloop can do all context switching, and build menus on the fly.
Meaning, it also allows other designs such as radials...
2003-10-25 00:08:12 +00:00
76fe6daa15 - another series of translated c files.
-Ton-
2003-04-26 11:56:44 +00:00
d0e346d544 updated .c files to include:
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

Just need to finish cpp files now :)

Kent
--
mein@cs.umn.edu
2002-11-25 12:02:15 +00:00
Hans Lambermont
12315f4d0e Initial revision 2002-10-12 11:37:38 +00:00