Commit Graph

44 Commits

Author SHA1 Message Date
c9341334b1 add BLI_strcpy_rlen, replace strcat, which was used in misleading way. 2013-06-16 08:29:02 +00:00
1777a69818 misc minor edits.
- pass string size to BLI_timestr() to avoid possible buffer overrun.
- quiet warning for mingw.
- include guards for windows utf conversion funcs.
- fix for mistage in edge-angle-selection check.
- some style cleanup.
2013-03-29 06:25:22 +00:00
0159647ada add BLI_strncpy_rlen(), a clone of BLI_strncpy() that returns the number of bytes copied.
also move doxy comments for BLI_string.h into the C file.
2013-03-14 10:07:05 +00:00
24da4a6032 fix [#34490] Copy and paste floating point number fields losses precision
- copy now gets up to 6 decimal places
- copy and UI float button editing now strip zeros: 1.000 -> 1.0
2013-03-04 04:21:51 +00:00
fd2907a0b6 add assert if zero is passed to string copy functions, would copy into first byte anyway. 2012-10-31 04:28:49 +00:00
d6d8de015c change BLI_strlen_range_utf8 to the more conventional BLI_strnlen_utf8 2012-10-27 02:47:39 +00:00
7dc19e0bc7 use __restrict for string functions args so the compiler can assume they dont overlap.
also avoid comparing int/size_t in for loops.
2012-10-10 04:47:53 +00:00
e84b300d9e use the format attribute in more places, disable X11 options when building with GHOST_SDL 2012-09-16 10:39:19 +00:00
1b487e9948 Some FFmpeg changes
- Make FFmpeg initialization called from creator, not from functions
  which requires FFmpeg. Makes it easier to follow when initialization
  should happen.

- Enable DNxHD codec. It was commented a while ago due to some strange
  behavior on some platforms. Re-tested it on Linux and Windows and
  it seemd to be working quite nice. Would let it be tested further,
  if it wouldn't be stable enough, easy to comment it again.

- Make non-error messages from writeffmpeg.c printed only if ffmpeg
  debug argument was passed to blender. Reduces console pollution
  with messages which are not useful for general troubleshooting.
  Error messages would still be printed to the console.

- Show FFmpeg error message when video stream failed to allocate.
  makes it easier to understand what exactly is wrong from Blender
  interface, no need to restart blender with FFmpeg debug flag and
  check for console messages.

  Used custom log callback for this which stores last error message
  in static variable. This is not thread safe, but with current
  design FFmpeg routines could not be called form several threads
  anyway, so think it's fine solution/
2012-08-26 11:01:14 +00:00
df107939c9 rename BLI_getQuotedStr --> BLI_str_quoted_substrN to make it more clear its doing an allocation. 2012-07-09 22:16:50 +00:00
b91bc4f037 use gcc attrubutes to warn on unused return values and arguments which shouldnt be NULL.
also remove IDP_AppendArray's return value which wasnt the new item in the array (which is odd/misleading), but wasnt used anywhere either.
2012-07-08 06:00:27 +00:00
9892736206 code cleanup: header cleanup and remove some duplicate defines. 2012-05-12 20:39:39 +00:00
7bbf4b7831 style cleanup
- spelling - turns out we had tessellation spelt wrong all over.
- use \directive for doxy (not @directive)
- remove BLI_sparsemap.h - was from bmesh merge IIRC but entire file commented and not used.
2012-03-02 16:05:54 +00:00
ea13ec1699 Spelling Cleanup 2012-03-01 12:20:18 +00:00
2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
1e4be0a4bf replace BLI_strtok_r from r41337 with lighter method that doesnt alloc for template_list 2011-10-29 08:18:42 +00:00
2ed7a66653 BLI_string: Adding the BLI_strtok_r function, which mimics stdlib strtok_r (unavailable on some systems).
It allows to iterate over a string, returning an new element each time, using a char as separator. See BLI_String.h's comments for more info and an example.

Needed by the UI template list patch following!
2011-10-28 13:07:11 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
8d6a554d75 - add BLI_string_utf8.h for unicode functions.
- move font.c unicode functions into string_utf8.c and rename to fit with other BLI_string funcs.
2011-10-20 09:47:05 +00:00
b6d0daa9cb utf8 editing for UI text input, this means backspace, delete, arrow keys properly move the cursor with multi-byte chars.
Note that this is only for the interface, text editor and python console still miss this feature.
2011-10-16 12:25:42 +00:00
9648c6016b fix [#28658] python can assign non utf8 and crash because of string lenth limits.
add BLI_strncpy_utf8() which which ensures there are no partially copied UTF8 characters, limited by the buffer size.
2011-09-15 11:49:36 +00:00
5ba213a424 move utf8 string.c functions into their own file, also add python tip for printing operators. 2011-09-15 08:07:42 +00:00
f6a2b8d724 BLI_strescape for a basic, python like string escaping, currently only use for drag and drop ID's into the console but should eventually be used for the animsys too. 2011-08-23 15:08:54 +00:00
78b8e4a437 remove BLI_streq() since it was hardly used, also replace string search with BLI_findstring(). 2011-05-26 21:04:01 +00:00
042a3ff382 Fix #27445: various operators missing with some non-english system languages.
In the case of this bug e.g. material.new became MATERiAL_OT_new, due to
different capitalization of "i" in Turkish. Fixed by not using the locale
dependent toupper/tolower functions.
2011-05-26 09:58:22 +00:00
77a1a2f14e use size_t rather then int for passing lengths to string functions since this is what guarded-malloc uses as well as stdlib.h. 2011-03-25 13:40:44 +00:00
2e5eb41522 pedantic warning cleanup, also remove texspace_edit() since its been added using a different method. 2011-02-27 08:31:10 +00:00
Nathan Letwory
b97ad119b9 doxygen: add blenlib under core as module. 2011-02-18 13:58:08 +00:00
6e47ffcc0d fix for uninitialized value in BLI_path_cwd() if PWD wasn't defined and the CWD was longer then 160. 2011-02-12 10:37:37 +00:00
0271ad6322 Give functions that use printf style formatting GCC format attributes so if incorrect formatting is used the compiler will warn of this.
found & fixed 2x incorrect formatting args.
2010-12-04 11:44:56 +00:00
8272ec2302 Description of BLI_strncpy() and BLI_strdupcat() were mixed up.
IRC reported by OniNiubbo
2010-11-29 14:29:30 +00:00
f28b5e672e python/utf8 compatibility fixes. (as discussed on the mailing list)
- user input gets non utf8 chars stripped all text input other then file paths.

- python has the same limitations, it will raise an error on non utf8 strings except for paths use unicode escape literals so its possible to deal with saving to these file paths from python.

- new string functions
  BLI_utf8_invalid_byte(str, len) returns the first invalid utf8 byte or -1 on on success.
  BLI_utf8_invalid_strip(str, len) strips non utf-8 chars.
2010-08-28 12:34:22 +00:00
9c1a9d9379 revert own commit 28662.
strnlen is a GNU extension according to http://unixpapa.com/incnote/string.html
2010-05-08 15:37:29 +00:00
ad068e6351 remove BLI_strnlen, use _strnlen as strnlen on windows.
cant test on windows but from what I can tell this exists like _vsnprintf
2010-05-08 07:34:01 +00:00
f09efddcda fix for minor errors/warnings 2010-03-03 13:59:57 +00:00
081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
b119ce5fcc Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)

** Drag works as follows:

- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented

** Drop works as follows:

- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata

- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.

- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.

** Currently implemented

Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images

Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 

Drop options:

- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image


** Drag and drop Notes:

- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.

- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.

- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 

- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.

- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.

- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.

- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)


** More notes

- Added saving for Region layouts (like split points for toolbar)

- Label buttons now handle mouse over

- File list: added full path entry for drop feature.

- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?

- Cocoa: added window move event, so multi-win setups work OK (didnt save).

- Interface_handlers.c: removed win->active

- Severe area copy bug: area handlers were not set to NULL

- Filesel bugfix: next/prev folder list was not copied on area copies

** Leftover todos

- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)

- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.

- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
237cd688aa Animation Editors: 'Only Selected' filtering option now works on Pose Channels too
* Only F-Curves and Drivers that affect selected bones will be visible when this happens. 
* Moved the function to grab text within a pair of "" following some prefix to blenlib.
2009-10-12 11:27:34 +00:00
2cf7d4867d (Untested) String Replacement Function in blenlib
Currently this hasn't been tested yet, but committing this first before I potentially use it for fixing RNA-paths...
2009-10-09 12:18:32 +00:00
333e231fa6 SVN maintenance. 2009-06-23 00:09:26 +00:00
c8b4cf9206 2.50:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD

Notes:
* Game and sequencer RNA, and sequencer header are now out of date
  a bit after changes in trunk.
* I didn't know how to port these bugfixes, most likely they are
  not needed anymore.
  * Fix "duplicate strip" always increase the user count for ipo.
  * IPO pinning on sequencer strips was lost during Undo.
2009-06-08 20:08:19 +00:00
5b3d7bfdf6 2.5
More cleanup!

- removed old UI font completely, including from uiBeginBlock
- emboss hints for uiBlock only have three types now;
  Regular, Pulldown, or "Nothing" (only icon/text)
- removed old font path from Userdef
- removed all old button theme hinting
- removed old "auto block" to merge buttons in groups
  (was only in use for radiosity buttons)

And went over all warnings. One hooray for make giving clean output :)
Well, we need uniform definitions for warnings, so people at least fix
them... here's the real bad bugs I found:

- in mesh code, a call to editmesh mixed *em and *me
- in armature, ED_util.h was not included, so no warnings for wrong call
  to ED_undo_push()
- The extern Py api .h was not included in the bpy_interface.c, showing
  a several calls using different args.

Further just added the missing includes, and removed unused vars.
2009-04-14 15:59:52 +00:00
985a4c1e5e RNA:
* Test with constructing RNA paths from pointer + property, based on
  a callback per struct. For animato we'll need to be able to do this,
  for keyframing from buttons, unless we can somehow derive the paths
  from the interface code, which seems like an unnecessary burden.

  However constructing such paths is not always quick, and we need a
  fast way to find out if a property is animated for drawing buttons,
  so this may not be the best solution.

  See rna_mesh.c for some callbacks created as a test.

* Added BLI_sprintfN to mallocN a new string using printf style
  formatting.
2009-03-25 20:29:01 +00:00
ebb6628a01 2.5 BLI_blenlib cleanup
DONE:
* moved almost all declarations from BLI_blenlib.h into their own proper header files.
* BLI_blenlib.h still includes all the declarations for convenience and to avoid changes in existing code
* split util.c into several files, where it wasn't done already
*    DynamicList -> dynamiclist, 
*    ListBase    -> listbase, 
*    String utility functions -> string.c
* removed a few unused macros and functions, if they're needed back, they're still in svn ;)
TODO:
* btempdir global
* further cleanup in the code of the different modules (especially util.c)
2008-12-20 10:02:00 +00:00