Commit Graph

335 Commits

Author SHA1 Message Date
ec4b6ba3f3 Fixed unreported bug: Backspace at top of text pushed newline onto undo stack 2008-06-04 16:03:19 +00:00
2dcab87383 Overwrite mode added, toggled with INSERTKEY 2008-06-04 12:32:06 +00:00
110f927c63 Changed frame numbering to only alter hashes if they are in the filename (not the directory name) to fix bug [#10566] File Open Dialog replaces '#' with '0' in directory names.
removed frame numbering from BLI_convertstringcode into its own function (BLI_convertstringframe), many uses of BLI_convertstringcode were passing dummy frames values anyway.
in cases where adding the current frame number to a filename is needed run BLI_convertstringframe(...) after BLI_convertstringcode(...)

There are some cases Im not sure BLI_convertstringframe is needed, these have been commented as todo, but at least have the same functionality they used to.
2008-05-04 09:41:15 +00:00
b846e7a3bf fix for #7314
solution provided by Leandro Inocencio
2008-05-02 15:45:15 +00:00
c8376869b1 BLI_split_dirfile was being used in cases it should not have been,
Added BLI_split_dirfile_basic, that only splits the path into directory and file. without checking the dir exists or creating it, without changing the original string that is passed to it.
2008-04-26 13:08:57 +00:00
b94f3d0fcb fix/workaround for blender crashing when running python runs text.clear() in background mode. ideally python api would not use this function. 2008-04-25 10:12:32 +00:00
Chris Want
5d0a207ecb Patch from GSR that a) fixes a whole bunch of GPL/BL license
blocks that were previously missed; and b) greatly increase my
ohloh stats!
2008-04-16 22:40:48 +00:00
ecc4ccf68f Fix compiling error.
Typo in text.c
2008-03-13 18:47:55 +00:00
217db14ae7 Fix for bug #8548: txt_copy_sel in txt_cut_sel only copied string in a local buffer.
Changed txt_cut_sel to use the clipboard.
2008-03-13 17:30:29 +00:00
d560b17088 fix for [#8408] Indentation error in text editor when typing a colon anywhere 2008-03-01 12:31:00 +00:00
Chris Want
5e3cffc64a Patch to change license to GPL only, from GSR. 2008-01-07 19:13:47 +00:00
58bf29e389 removed blenderdef.h, BIF_*, BDR_* and BSE_* header files (except for BIF_gl.h and BIF_glutil.h) 2008-01-01 18:16:10 +00:00
021cd4aac3 python api
removed most custom add_*data* wrappers from Main.c
removed makeCurrent() from Text.c (was never in a release), use "bpy.texts.active = text" now
clamp new image sizes
made add_empty_action accept a string rather then a blocktype since the blocktype was only being used to choose one of 3 strings anyway.
2007-03-12 06:21:58 +00:00
e0c77c0f14 made all data adding functions accept a name such as add_mesh or add_curve, previously only some datatypes adding functions accepted a name.
also updated the Bpy.py epydocs
2007-03-11 16:25:17 +00:00
bb802607eb Bugfix #1676
Ancient bug: texteditor input was limited to "isprint()" characters, the
default non-accented simple ascii set. I've removed that.

Now we still have a conflict with hotkey handling, so ALT+character input
won't work. But, for keyboards that have special character keys from itself,
this patch will allow typing them in Text now.
2006-11-26 16:03:36 +00:00
Ken Hughes
dfb545a77c Fix some warning for unsigned vs signed comparisons. 2006-04-03 20:31:10 +00:00
042d612df2 Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:

Render:
- Full cleanup of render code, removing *all* globals and bad level calls
  all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
  default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
  tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.

Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
  easier use of movies in Blender

PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
  code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)

3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
  (pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
  rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!

Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
  with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
  done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
  window. (yes, output nodes to render-result, and to files, is on the list!)

The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
  system should be built from scratch. I can't really understand this code...
  I expect it is not much needed, especially with advanced layer/passes
  control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
  recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
  effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
  to check first the option to render to a Image window, so Blender can become
  a true single-window application. :)
  For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again

OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
b1c6fe7337 Bug #3658 reported by Daniel Holtz (thanks):
http://projects.blender.org/tracker/?func=detail&atid=125&aid=3658&group_id=9

Running scripts from command line in bg mode:
blender -b -P myscript.py
crashes Blender 2.40.

The problem is in add_text() in text.c: G.scene can be NULL at this
point (in bg mode). Added a check:

line 323:
	if (G.scene) /* can be NULL (bg mode) */
		BLI_convertstringcode(str, G.sce, G.scene->r.cfra);

The text being added with add_text() in this particular case is the
script filename specified at the command prompt, so it should be ok to skip
BLI_convertstringcode. Feel free to disagree, though.
2006-01-06 20:15:18 +00:00
Stephen Swaney
d32b100464 bugfix: #3420 Indent/Unindent in text editor not undoable
contributed by Mr. TextEditor - themyers.  Thanks!
2005-12-12 18:35:15 +00:00
d1be55f41c Small fix to allow relative filenames for textfiles. 2005-11-06 16:32:54 +00:00
Stephen Swaney
615c2f40a1 text editor patch by antihc3.
fixes 'Memoryblock free: attempt to free NULL pointer' errors.
2005-05-19 03:15:49 +00:00
c1936cff60 fixed it sending null to MEM_freeN
.
2005-05-18 23:54:56 +00:00
2d6481c41c TextEditor: syntax color support.
Patch provided by Ricki Myers. Works quite obvious, see Theme editor too!

Notes about the provided code;
- The default syntax colors were screaming! Toned it down to match the
  default dark on lightgrey background better.
- Added: initializing colors in saved themes (usiblender.c)
- The implementation of the button for this option was quite clumsy...
  Blender UI options services this a lot easier.
  (Same fixed for 'line numbers' option)
- Bracket matching now uses as color a mix of backdrop and the
  selected-text color. Noticed my texteditor did it too...

-> I really miss comments in code describing a little bit the thought
   process behind the code. Like a short introduction on this feature
   in the top of the drawtext.c, little remarks on new functions.
   ALso in patch tracker or the mailinglist no docs was mentioned?

-> drawtext.c now gets messy quickly... lack of overview, structure,
   and confusing mix of personal coding styles.
   For not-active supported code dangerous...
2005-05-13 16:11:28 +00:00
09fb5d6b8d BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events).  Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).

- Updated Window and Window.Theme with new theme vars and the Time space.

- Script links:

-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.

-- Added "Enable Script Links" button in the script buttons tab.  Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default.  "blender -y" also disables all slinks as happened before with OnLoad ones only.

-- Other small changes in the script buttons tab:
  When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
  Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type.  Cancel the popup to leave the string button empty (link exists, but has no script assigned).  A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown.  With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.

-- Implemented Ton's space handler script links:

Right now only for the 3d View,  but it's trivial to add for others.  There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window.  Ton's idea was to give scripts a controlled way to integrate better within Blender.

Here's how it works:

- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT

and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu.  Check (mark, click on it) a script to make it active.

EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:

import Blender
from Blender import Draw

evt = Blender.event
if evt == Draw.AKEY:
  print "a"
elif evt == Draw.LEFTMOUSE:
  print "left mouse button"
else:
  return # ignore, pass event back to Blender

Blender.event = None # tell Blender not to process itself the event

DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.

To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.

Still need to code some nice example, which should also serve to test properly space handlers.  Simple tests went fine.

- doc updates about the additions.

=======

Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable.  Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are.  The tooltips may not be accepted either, since other menus don't use them.  Opinions welcomed.
2005-05-08 21:20:34 +00:00
b705434c72 A couple more simple gcc4.X warnings fixed.
softbody.c I removed an unused var.
text.c added return values to 2 return statements that didn't have anything.
Makefile added $(FIX_STUBS_WARNINGS) to CFLAGS for the stub.
source/blender/src/editface.c  fixed up int vs unsigned int stuff
source/blender/src/resources.c had two vars declared as unsigned char *
and then inputs to them were cast as char * so updated the casts.

Kent
2005-04-28 14:37:15 +00:00
Stephen Swaney
e8a6bf6fb9 Bugfix for disappearing hilight bug and code re-org for text editor
from Ricki Myers (themyers).

Comes with nice juicy commit msg, too!

- source/blender/blenkernel/BKE_text.h

	- Removed indent_paste, uncommen, unindent_lines, comment_paste,
	uncomment_paste, uncomment, set_tabs.

	All these functions cut and re-added text (I felt this was
	unsafe). whicch is was caused the highlight loss.


	- Now the only functions are Indent, Unindent, comment, uncomment,
	  setcurr_tab. 	All these functions only take one @parm (struct Text)

	-indent(struct Text *text)
		copy's the selected text in a MEM_mallocN line by line added a
		tab at the begginning

	- Unindent(struct Text *text)
		Tests if current line starts with a tab.
		if TAB remove it
	- comment(struct Text *text)
		copy's the selected text in a MEM_mallocN and adding a # at the begginning

	- Uncomment(struct Text *text)
		Tests if current line starts with a #.
		if # remove it

	- setcurr_tab (Text *text)
		Checks for Tabs pri. to any text
		if : is found and not in a comment then Tabs is increased by one
		if "return", "break", "pass" is found then Tabs is decreased

- blender/source/blender/src/header_text.c

	Changed:	txt_cut_sel(text);
			indent_paste(text);
	TO:
			txt_order_cursors(text);
			indent(text);
	* no more cutting of the text

- source/blender/src/drawtext.c

	set_tabs(Text *text) just calls setcurr_tab(text);
2005-04-10 14:01:41 +00:00
Stephen Swaney
4ac4629905 a patch for the Text editor contributed by themeyers.
adds new features for indenting and commenting.

Note: I am not sure if the best menu spot for these features
is under the Select menu, but we can argue about that later.
They do work on a selection, though.

from the mailing list post:

1&2. Added Indent/Unindent under Edit->Select
just select the text you want to indent and go to the menu (
note if nothing is selected Indent will just indent ( tab )
the line the line )

3&4. Added Comment/Uncomment to the same menu
same applies as above

5. Added Tab setting on the menu bar in text editor
Sets the number of spaces a tab ==
changing the setting will change the hole script

6. Added Auto indent
when you hit enter it goes to the next line at the same
tab number and the line above it ( needs more testing and input)
2004-10-14 23:37:04 +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
90541541c3 Added all necessary BPY_extern.h include files to the .c files.
Updated the Make environment to point to the correct location. The include
paths were still pointing to source/blender/bpython/include while it should be
source/blender/python.
I did not encounter the build problems because I'm always working with the
autoconf build environment.
2003-11-23 14:28:46 +00:00
Chris Want
e7d3e24a0e Got rid of many #include "BPY_extern.h"
Homework from Michel: do grep BPY source/blender/src/*
and see if there is anything that needs fixing.
2003-11-22 20:21:59 +00:00
Stephen Swaney
e00aa5375c fix for bug #285
text buffer not marked as modified after delete operation
2003-11-10 05:51:55 +00:00
Florian Eggenberger
66e2bf39d9 When cutting out a part of a python script the old textbuffer was still used when executing the script. Adding a txt_make_dirty() to txt_cut_sel() helped. 2003-07-10 18:32:42 +00:00
1458560f6d The last of the blenkernel files with translated comments 2003-04-26 13:07:59 +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