This commit is contained in:
Campbell Barton 2011-05-12 05:35:19 +00:00
commit 191ad54599
38 changed files with 574 additions and 969 deletions

View File

@ -145,10 +145,6 @@
* merged in docs.
*/
/** \defgroup blo readblenfile
* \ingroup blender data
*/
/** \defgroup quicktime quicktime
* \ingroup blender

View File

@ -42,7 +42,7 @@
#include <iostream>
#ifdef FREE_WINDOWS
# define _WIN32_WINNT 0x0500 /* GetConsoleWindow() for MinGW */
# define WINVER 0x0501 /* GetConsoleWindow() for MinGW */
#endif
#include "GHOST_SystemWin32.h"

View File

@ -127,8 +127,6 @@ DECLARE_HANDLE(HRAWINPUT);
#ifdef FREE_WINDOWS
#define NEED_RAW_PROC
typedef BOOL (WINAPI * LPFNDLLRRID)(RAWINPUTDEVICE*,UINT, UINT);
#define RegisterRawInputDevices(pRawInputDevices, uiNumDevices, cbSize) ((pRegisterRawInputDevices)?pRegisterRawInputDevices(pRawInputDevices, uiNumDevices, cbSize):0)
typedef UINT (WINAPI * LPFNDLLGRID)(HRAWINPUT, UINT, LPVOID, PUINT, UINT);
#define GetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader) ((pGetRawInputData)?pGetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader):(UINT)-1)

View File

@ -92,7 +92,6 @@ add_subdirectory(bmesh)
add_subdirectory(render)
add_subdirectory(blenfont)
add_subdirectory(blenloader)
add_subdirectory(readblenfile)
add_subdirectory(blenpluginapi)
add_subdirectory(ikplugin)
add_subdirectory(gpu)

View File

@ -13,7 +13,6 @@ SConscript(['avi/SConscript',
'imbuf/SConscript',
'makesdna/SConscript',
'makesrna/SConscript',
'readblenfile/SConscript',
'render/SConscript',
'nodes/SConscript',
'modifiers/SConscript',

View File

@ -90,8 +90,7 @@ void brush_painter_free(BrushPainter *painter);
unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side);
/* radial control */
void brush_radial_control_invoke(struct wmOperator *op, struct Brush *br, float size_weight);
int brush_radial_control_exec(struct wmOperator *op, struct Brush *br, float size_weight);
struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br);
/* unified strength and size */

View File

@ -426,13 +426,6 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset)
curvemapping_changed(b->curve, 0);
}
static MTex *brush_active_texture(Brush *brush)
{
if(brush)
return &brush->mtex;
return NULL;
}
int brush_texture_set_nr(Brush *brush, int nr)
{
ID *idtest, *id=NULL;
@ -1185,7 +1178,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side)
}
/**** Radial Control ****/
static struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
{
ImBuf *im = MEM_callocN(sizeof(ImBuf), "radial control texture");
unsigned int *texcache;
@ -1219,50 +1212,6 @@ static struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
return im;
}
void brush_radial_control_invoke(wmOperator *op, Brush *br, float size_weight)
{
int mode = RNA_enum_get(op->ptr, "mode");
float original_value= 0;
if(mode == WM_RADIALCONTROL_SIZE)
original_value = brush_size(br) * size_weight;
else if(mode == WM_RADIALCONTROL_STRENGTH)
original_value = brush_alpha(br);
else if(mode == WM_RADIALCONTROL_ANGLE) {
MTex *mtex = brush_active_texture(br);
if(mtex)
original_value = mtex->rot;
}
RNA_float_set(op->ptr, "initial_value", original_value);
op->customdata = brush_gen_radial_control_imbuf(br);
}
int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight)
{
int mode = RNA_enum_get(op->ptr, "mode");
float new_value = RNA_float_get(op->ptr, "new_value");
const float conv = 0.017453293;
if(mode == WM_RADIALCONTROL_SIZE)
if (brush_use_locked_size(br)) {
float initial_value = RNA_float_get(op->ptr, "initial_value");
const float unprojected_radius = brush_unprojected_radius(br);
brush_set_unprojected_radius(br, unprojected_radius * new_value/initial_value * size_weight);
}
else
brush_set_size(br, new_value * size_weight);
else if(mode == WM_RADIALCONTROL_STRENGTH)
brush_set_alpha(br, new_value);
else if(mode == WM_RADIALCONTROL_ANGLE) {
MTex *mtex = brush_active_texture(br);
if(mtex)
mtex->rot = new_value * conv;
}
return OPERATOR_FINISHED;
}
/* Unified Size and Strength */
static void set_unified_settings(Brush *brush, short flag, int value)

View File

@ -25,27 +25,29 @@
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*
*/
#include <string.h> // strlen
#include "BLO_readblenfile.h"
struct streamGlueControlStruct *Global_streamGlueControl;
#ifndef BLO_RUNTIME_H
#define BLO_RUNTIME_H
int
streamGlueWrite(
struct streamGlueControlStruct *streamGlueControl,
struct streamGlueStruct **streamGlue,
unsigned char *data,
unsigned int dataIn,
int finishUp)
{
printf("called with %d bytes in buffer [%s]\n", dataIn, data);
return (0);
/** \file BLO_runtime.h
* \ingroup blenloader
*/
#ifdef __cplusplus
extern "C" {
#endif
struct BlendFileData;
struct ReportList;
int BLO_is_a_runtime(char *file);
struct BlendFileData *BLO_read_runtime(char *file, struct ReportList *reports);
#ifdef __cplusplus
}
#endif
main()
{
int err;
#endif /* BLO_RUNTIME_H */
err = BLO_readblenfile();
}

View File

@ -29,7 +29,6 @@ set(INC
../blenlib
../blenkernel
../makesdna
../readblenfile
../makesrna
../render/extern/include
../../../intern/guardedalloc
@ -39,10 +38,12 @@ set(INC
set(SRC
intern/readblenentry.c
intern/readfile.c
intern/runtime.c
intern/undofile.c
intern/writefile.c
BLO_readfile.h
BLO_runtime.h
BLO_soundfile.h
BLO_sys_types.h
BLO_undofile.h

View File

@ -4,7 +4,7 @@ Import ('env')
sources = env.Glob('intern/*.c')
incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
incs += ' ../makesdna ../readblenfile ../editors/include'
incs += ' ../makesdna ../editors/include'
incs += ' ../render/extern/include ../makesrna ../bmesh'
incs += ' ' + env['BF_ZLIB_INC']

View File

@ -62,8 +62,6 @@
#include "readfile.h"
#include "BLO_readblenfile.h"
#include "BLO_sys_types.h" // needed for intptr_t
#ifdef _WIN32

View File

@ -139,7 +139,6 @@
//XXX #include "BIF_previewrender.h" // bedlelvel, for struct RenderInfo
#include "BLO_readfile.h"
#include "BLO_undofile.h"
#include "BLO_readblenfile.h" // streaming read pipe, for BLO_readblenfile BLO_readblenfilememory
#include "readfile.h"

View File

@ -27,11 +27,13 @@
* ***** END GPL LICENSE BLOCK *****
*
*/
/**
* \file BLO_readblenfile.c
* \brief This file handles the loading if .blend files
* \ingroup blo
* \file runtime.c
* \brief This file handles the loading of .blend files embedded in runtimes
* \ingroup blenloader
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -46,90 +48,56 @@
#endif
#include "BLO_readfile.h"
#include "BLO_readblenfile.h"
#include "BLO_runtime.h"
#include "BKE_blender.h"
#include "BKE_report.h"
#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
/** Magic number for the file header */
const char *headerMagic = "BLENDFI";
/**
* \brief Set the version number into the array.
*
* version contains the integer number of the version
* i.e. 227
* array[1] gets set to the div of the number by 100 i.e. 2
* array[2] gets the remainder i.e. 27
*/
void BLO_setversionnumber(char array[4], int version)
{
memset(array, 0, sizeof(char)*4);
array[1] = version / 100;
array[2] = version % 100;
}
/**
* Sets version number using BLENDER_VERSION
* Function that calls the setversionnumber(char[],int) with
* the BLENDER_VERSION constant and sets the resultant array
* with the version parts.
* see BLO_setversionnumber(char[],int).
*/
void BLO_setcurrentversionnumber(char array[4])
{
BLO_setversionnumber(array, BLENDER_VERSION);
}
#ifndef O_BINARY
#define O_BINARY 0
#endif
/* Runtime reading */
static int handle_read_msb_int(int handle) {
static int handle_read_msb_int(int handle)
{
unsigned char buf[4];
if (read(handle, buf, 4)!=4)
if(read(handle, buf, 4) != 4)
return -1;
else
return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0);
return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0);
}
int blo_is_a_runtime(char *path) {
int BLO_is_a_runtime(char *path)
{
int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0);
int datastart;
char buf[8];
if (fd==-1)
if(fd==-1)
goto cleanup;
lseek(fd, -12, SEEK_END);
datastart= handle_read_msb_int(fd);
if (datastart==-1)
if(datastart==-1)
goto cleanup;
else if (read(fd, buf, 8)!=8)
else if(read(fd, buf, 8)!=8)
goto cleanup;
else if (memcmp(buf, "BRUNTIME", 8)!=0)
else if(memcmp(buf, "BRUNTIME", 8)!=0)
goto cleanup;
else
res= 1;
cleanup:
if (fd!=-1)
if(fd!=-1)
close(fd);
return res;
}
BlendFileData *
blo_read_runtime(
char *path,
ReportList *reports)
BlendFileData *BLO_read_runtime(char *path, ReportList *reports)
{
BlendFileData *bfd= NULL;
size_t actualsize;
@ -137,7 +105,8 @@ blo_read_runtime(
char buf[8];
fd= open(path, O_BINARY|O_RDONLY, 0);
if (fd==-1) {
if(fd==-1) {
BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", path, strerror(errno));
goto cleanup;
}
@ -147,16 +116,20 @@ blo_read_runtime(
lseek(fd, -12, SEEK_END);
datastart= handle_read_msb_int(fd);
if (datastart==-1) {
if(datastart==-1) {
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (problem seeking)", path);
goto cleanup;
} else if (read(fd, buf, 8)!=8) {
}
else if(read(fd, buf, 8)!=8) {
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (truncated header)", path);
goto cleanup;
} else if (memcmp(buf, "BRUNTIME", 8)!=0) {
}
else if(memcmp(buf, "BRUNTIME", 8)!=0) {
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (not a blend file)", path);
goto cleanup;
} else {
}
else {
//printf("starting to read runtime from %s at datastart %d\n", path, datastart);
lseek(fd, datastart, SEEK_SET);
bfd = blo_read_blendafterruntime(fd, path, actualsize-datastart, reports);
@ -164,7 +137,7 @@ blo_read_runtime(
}
cleanup:
if (fd!=-1)
if(fd!=-1)
close(fd);
return bfd;

View File

@ -2521,80 +2521,6 @@ static void toggle_particle_cursor(bContext *C, int enable)
pset->paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), PE_poll_view3d, brush_drawcursor, NULL);
}
/********************* radial control operator *********************/
static int brush_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ParticleEditSettings *pset= PE_settings(CTX_data_scene(C));
ParticleBrushData *brush;
int mode = RNA_enum_get(op->ptr, "mode");
float original_value=1.0f;
if(pset->brushtype < 0)
return OPERATOR_CANCELLED;
brush= &pset->brush[pset->brushtype];
toggle_particle_cursor(C, 0);
if(mode == WM_RADIALCONTROL_SIZE)
original_value = brush->size;
else if(mode == WM_RADIALCONTROL_STRENGTH)
original_value = brush->strength;
RNA_float_set(op->ptr, "initial_value", original_value);
return WM_radial_control_invoke(C, op, event);
}
static int brush_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
{
int ret = WM_radial_control_modal(C, op, event);
if(ret != OPERATOR_RUNNING_MODAL)
toggle_particle_cursor(C, 1);
return ret;
}
static int brush_radial_control_exec(bContext *C, wmOperator *op)
{
ParticleEditSettings *pset= PE_settings(CTX_data_scene(C));
ParticleBrushData *brush;
int mode = RNA_enum_get(op->ptr, "mode");
float new_value = RNA_float_get(op->ptr, "new_value");
if(pset->brushtype < 0)
return OPERATOR_CANCELLED;
brush= &pset->brush[pset->brushtype];
if(mode == WM_RADIALCONTROL_SIZE)
brush->size= new_value;
else if(mode == WM_RADIALCONTROL_STRENGTH)
brush->strength= new_value;
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
}
void PARTICLE_OT_brush_radial_control(wmOperatorType *ot)
{
WM_OT_radial_control_partial(ot);
ot->name= "Brush Radial Control";
ot->idname= "PARTICLE_OT_brush_radial_control";
ot->invoke= brush_radial_control_invoke;
ot->modal= brush_radial_control_modal;
ot->exec= brush_radial_control_exec;
ot->poll= PE_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
}
/*************************** delete operator **************************/
enum { DEL_PARTICLE, DEL_KEY };

View File

@ -60,7 +60,6 @@ void PARTICLE_OT_delete(struct wmOperatorType *ot);
void PARTICLE_OT_mirror(struct wmOperatorType *ot);
void PARTICLE_OT_brush_edit(struct wmOperatorType *ot);
void PARTICLE_OT_brush_radial_control(struct wmOperatorType *ot);
void PARTICLE_OT_particle_edit_toggle(struct wmOperatorType *ot);
void PARTICLE_OT_edited_clear(struct wmOperatorType *ot);

View File

@ -66,7 +66,6 @@ static void operatortypes_particle(void)
WM_operatortype_append(PARTICLE_OT_mirror);
WM_operatortype_append(PARTICLE_OT_brush_edit);
WM_operatortype_append(PARTICLE_OT_brush_radial_control);
WM_operatortype_append(PARTICLE_OT_particle_edit_toggle);
WM_operatortype_append(PARTICLE_OT_edited_clear);
@ -91,6 +90,7 @@ static void operatortypes_particle(void)
static void keymap_particle(wmKeyConfig *keyconf)
{
wmKeyMapItem *kmi;
wmKeyMap *keymap;
keymap= WM_keymap_find(keyconf, "Particle", 0, 0);
@ -112,8 +112,14 @@ static void keymap_particle(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
/* size radial control */
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.particle_edit.brush.size");
/* size radial control */
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.particle_edit.brush.strength");
WM_keymap_add_menu(keymap, "VIEW3D_MT_particle_specials", WKEY, KM_PRESS, 0, 0);

View File

@ -5092,56 +5092,6 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings)
}
}
/* ************ image paint radial control *************/
static int paint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
float zoom;
ToolSettings *ts = CTX_data_scene(C)->toolsettings;
get_imapaint_zoom(C, &zoom, &zoom);
toggle_paint_cursor(C, 0);
brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), zoom);
return WM_radial_control_invoke(C, op, event);
}
static int paint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
{
int ret = WM_radial_control_modal(C, op, event);
if(ret != OPERATOR_RUNNING_MODAL)
toggle_paint_cursor(C, 1);
return ret;
}
static int paint_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint);
float zoom;
int ret;
char str[64];
get_imapaint_zoom(C, &zoom, &zoom);
ret = brush_radial_control_exec(op, brush, 1.0f / zoom);
WM_radial_control_string(op, str, sizeof(str));
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}
void PAINT_OT_image_paint_radial_control(wmOperatorType *ot)
{
WM_OT_radial_control_partial(ot);
ot->name= "Image Paint Radial Control";
ot->idname= "PAINT_OT_image_paint_radial_control";
ot->invoke= paint_radial_control_invoke;
ot->modal= paint_radial_control_modal;
ot->exec= paint_radial_control_exec;
ot->poll= image_paint_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
}
/************************ grab clone operator ************************/
typedef struct GrabClone {
@ -5469,28 +5419,6 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
/************* texture paint radial control *************/
static int texture_paint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ToolSettings *ts = CTX_data_scene(C)->toolsettings;
toggle_paint_cursor(C, !ts->imapaint.paintcursor);
brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), 1);
return WM_radial_control_invoke(C, op, event);
}
static int texture_paint_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint);
int ret = brush_radial_control_exec(op, brush, 1);
char str[64];
WM_radial_control_string(op, str, sizeof(str));
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}
static int texture_paint_poll(bContext *C)
{
if(texture_paint_toggle_poll(C))
@ -5505,23 +5433,6 @@ int image_texture_paint_poll(bContext *C)
return (texture_paint_poll(C) || image_paint_poll(C));
}
void PAINT_OT_texture_paint_radial_control(wmOperatorType *ot)
{
WM_OT_radial_control_partial(ot);
ot->name= "Texture Paint Radial Control";
ot->idname= "PAINT_OT_texture_paint_radial_control";
ot->invoke= texture_paint_radial_control_invoke;
ot->modal= paint_radial_control_modal;
ot->exec= texture_paint_radial_control_exec;
ot->poll= texture_paint_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
}
int facemask_paint_poll(bContext *C)
{
return paint_facesel_test(CTX_data_active_object(C));

View File

@ -81,12 +81,10 @@ void vpaint_fill(struct Object *ob, unsigned int paintcol);
void wpaint_fill(struct VPaint *wp, struct Object *ob, float paintweight);
void PAINT_OT_weight_paint_toggle(struct wmOperatorType *ot);
void PAINT_OT_weight_paint_radial_control(struct wmOperatorType *ot);
void PAINT_OT_weight_paint(struct wmOperatorType *ot);
void PAINT_OT_weight_set(struct wmOperatorType *ot);
void PAINT_OT_weight_from_bones(struct wmOperatorType *ot);
void PAINT_OT_vertex_paint_radial_control(struct wmOperatorType *ot);
void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot);
void PAINT_OT_vertex_paint(struct wmOperatorType *ot);
@ -96,12 +94,10 @@ unsigned int vpaint_get_current_col(struct VPaint *vp);
int image_texture_paint_poll(struct bContext *C);
void PAINT_OT_image_paint(struct wmOperatorType *ot);
void PAINT_OT_image_paint_radial_control(struct wmOperatorType *ot);
void PAINT_OT_grab_clone(struct wmOperatorType *ot);
void PAINT_OT_sample_color(struct wmOperatorType *ot);
void PAINT_OT_clone_cursor_set(struct wmOperatorType *ot);
void PAINT_OT_texture_paint_toggle(struct wmOperatorType *ot);
void PAINT_OT_texture_paint_radial_control(struct wmOperatorType *ot);
void PAINT_OT_project_image(struct wmOperatorType *ot);
void PAINT_OT_image_from_view(struct wmOperatorType *ot);

View File

@ -23,7 +23,10 @@
* \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
#include <stdlib.h>
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "DNA_object_types.h"
@ -355,9 +358,7 @@ void ED_operatortypes_paint(void)
/* image */
WM_operatortype_append(PAINT_OT_texture_paint_toggle);
WM_operatortype_append(PAINT_OT_texture_paint_radial_control);
WM_operatortype_append(PAINT_OT_image_paint);
WM_operatortype_append(PAINT_OT_image_paint_radial_control);
WM_operatortype_append(PAINT_OT_sample_color);
WM_operatortype_append(PAINT_OT_grab_clone);
WM_operatortype_append(PAINT_OT_clone_cursor_set);
@ -366,13 +367,11 @@ void ED_operatortypes_paint(void)
/* weight */
WM_operatortype_append(PAINT_OT_weight_paint_toggle);
WM_operatortype_append(PAINT_OT_weight_paint_radial_control);
WM_operatortype_append(PAINT_OT_weight_paint);
WM_operatortype_append(PAINT_OT_weight_set);
WM_operatortype_append(PAINT_OT_weight_from_bones);
/* vertex */
WM_operatortype_append(PAINT_OT_vertex_paint_radial_control);
WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
WM_operatortype_append(PAINT_OT_vertex_paint);
WM_operatortype_append(PAINT_OT_vertex_color_set);
@ -464,6 +463,59 @@ static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path
RNA_float_set(kmi->ptr, "scalar", 10.0/9.0); // 1.1111....
}
typedef enum {
RC_COLOR = 1,
RC_ROTATION = 2,
RC_ZOOM = 4,
} RCFlags;
static void set_brush_rc_path(PointerRNA *ptr, const char *brush_path,
const char *output_name, const char *input_name)
{
char *path;
path = BLI_sprintfN("%s.%s", brush_path, input_name);
RNA_string_set(ptr, output_name, path);
MEM_freeN(path);
}
static void set_brush_rc_props(PointerRNA *ptr, const char *paint,
const char *prop, RCFlags flags)
{
char *brush_path;
brush_path = BLI_sprintfN("tool_settings.%s.brush", paint);
set_brush_rc_path(ptr, brush_path, "data_path", prop);
set_brush_rc_path(ptr, brush_path, "color_path", "cursor_color_add");
set_brush_rc_path(ptr, brush_path, "rotation_path", "texture_slot.angle");
RNA_string_set(ptr, "image_id", brush_path);
if(flags & RC_COLOR)
set_brush_rc_path(ptr, brush_path, "fill_color_path", "color");
if(flags & RC_ZOOM)
RNA_string_set(ptr, "zoom_path", "space_data.zoom");
MEM_freeN(brush_path);
}
static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *paint,
RCFlags flags)
{
wmKeyMapItem *kmi;
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, 0, 0);
set_brush_rc_props(kmi->ptr, paint, "size", flags);
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
set_brush_rc_props(kmi->ptr, paint, "strength", flags);
if(flags & RC_ROTATION) {
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0);
set_brush_rc_props(kmi->ptr, paint, "texture_slot.angle", flags);
}
}
void ED_keymap_paint(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
@ -474,10 +526,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
keymap= WM_keymap_find(keyconf, "Sculpt", 0, 0);
keymap->poll= sculpt_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", WM_RADIALCONTROL_ANGLE);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", BRUSH_STROKE_INVERT);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", BRUSH_STROKE_SMOOTH);
@ -496,6 +544,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
ed_keymap_paint_brush_switch(keymap, "sculpt");
ed_keymap_paint_brush_size(keymap, "tool_settings.sculpt.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "sculpt", RC_ROTATION);
RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", DKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_DRAW);
RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", SKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_SMOOTH);
@ -521,8 +570,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
keymap->poll= vertex_paint_mode_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
@ -531,6 +578,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
ed_keymap_paint_brush_switch(keymap, "vertex_paint");
ed_keymap_paint_brush_size(keymap, "tool_settings.vertex_paint.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "vertex_paint", RC_COLOR);
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */
RNA_string_set(kmi->ptr, "data_path", "vertex_paint_object.data.use_paint_mask");
@ -539,9 +587,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
keymap= WM_keymap_find(keyconf, "Weight Paint", 0, 0);
keymap->poll= weight_paint_mode_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap,
@ -549,6 +594,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
ed_keymap_paint_brush_switch(keymap, "weight_paint");
ed_keymap_paint_brush_size(keymap, "tool_settings.weight_paint.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "weight_paint", 0);
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */
RNA_string_set(kmi->ptr, "data_path", "weight_paint_object.data.use_paint_mask");
@ -559,12 +605,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0);
keymap->poll= image_texture_paint_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_grab_clone", RIGHTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
@ -572,6 +612,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
ed_keymap_paint_brush_switch(keymap, "image_paint");
ed_keymap_paint_brush_size(keymap, "tool_settings.image_paint.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "image_paint", RC_COLOR|RC_ZOOM);
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */
RNA_string_set(kmi->ptr, "data_path", "image_paint_object.data.use_paint_mask");

View File

@ -1205,110 +1205,6 @@ void PAINT_OT_weight_paint_toggle(wmOperatorType *ot)
}
/* ************ paint radial controls *************/
static int vpaint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Paint *p = paint_get_active(CTX_data_scene(C));
Brush *brush = paint_brush(p);
float col[4];
WM_paint_cursor_end(CTX_wm_manager(C), p->paint_cursor);
p->paint_cursor = NULL;
brush_radial_control_invoke(op, brush, 1);
copy_v3_v3(col, brush->add_col);
col[3]= 0.5f;
RNA_float_set_array(op->ptr, "color", col);
return WM_radial_control_invoke(C, op, event);
}
static int vpaint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
{
int ret = WM_radial_control_modal(C, op, event);
if(ret != OPERATOR_RUNNING_MODAL)
paint_cursor_start(C, vertex_paint_poll);
return ret;
}
static int vpaint_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->vpaint->paint);
int ret = brush_radial_control_exec(op, brush, 1);
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}
static int wpaint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Paint *p = paint_get_active(CTX_data_scene(C));
Brush *brush = paint_brush(p);
float col[4];
WM_paint_cursor_end(CTX_wm_manager(C), p->paint_cursor);
p->paint_cursor = NULL;
brush_radial_control_invoke(op, brush, 1);
copy_v3_v3(col, brush->add_col);
col[3]= 0.5f;
RNA_float_set_array(op->ptr, "color", col);
return WM_radial_control_invoke(C, op, event);
}
static int wpaint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
{
int ret = WM_radial_control_modal(C, op, event);
if(ret != OPERATOR_RUNNING_MODAL)
paint_cursor_start(C, weight_paint_poll);
return ret;
}
static int wpaint_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->wpaint->paint);
int ret = brush_radial_control_exec(op, brush, 1);
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}
void PAINT_OT_weight_paint_radial_control(wmOperatorType *ot)
{
WM_OT_radial_control_partial(ot);
ot->name= "Weight Paint Radial Control";
ot->idname= "PAINT_OT_weight_paint_radial_control";
ot->invoke= wpaint_radial_control_invoke;
ot->modal= wpaint_radial_control_modal;
ot->exec= wpaint_radial_control_exec;
ot->poll= weight_paint_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
}
void PAINT_OT_vertex_paint_radial_control(wmOperatorType *ot)
{
WM_OT_radial_control_partial(ot);
ot->name= "Vertex Paint Radial Control";
ot->idname= "PAINT_OT_vertex_paint_radial_control";
ot->invoke= vpaint_radial_control_invoke;
ot->modal= vpaint_radial_control_modal;
ot->exec= vpaint_radial_control_exec;
ot->poll= vertex_paint_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
}
/* ************ weight paint operator ********** */
struct WPaintData {

View File

@ -2837,65 +2837,6 @@ static const char *sculpt_tool_name(Sculpt *sd)
}
}
/**** Radial control ****/
static int sculpt_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Paint *p = paint_get_active(CTX_data_scene(C));
Brush *brush = paint_brush(p);
float col[4], tex_col[4];
WM_paint_cursor_end(CTX_wm_manager(C), p->paint_cursor);
p->paint_cursor = NULL;
brush_radial_control_invoke(op, brush, 1);
if((brush->flag & BRUSH_DIR_IN) && ELEM4(brush->sculpt_tool, SCULPT_TOOL_DRAW, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_PINCH))
copy_v3_v3(col, brush->sub_col);
else
copy_v3_v3(col, brush->add_col);
col[3]= 0.5f;
copy_v3_v3(tex_col, U.sculpt_paint_overlay_col);
tex_col[3]= (brush->texture_overlay_alpha / 100.0f);
RNA_float_set_array(op->ptr, "color", col);
RNA_float_set_array(op->ptr, "texture_color", tex_col);
return WM_radial_control_invoke(C, op, event);
}
static int sculpt_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
{
int ret = WM_radial_control_modal(C, op, event);
if(ret != OPERATOR_RUNNING_MODAL)
paint_cursor_start(C, sculpt_poll);
return ret;
}
static int sculpt_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_tool_settings(C)->sculpt->paint);
int ret = brush_radial_control_exec(op, brush, 1);
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}
static void SCULPT_OT_radial_control(wmOperatorType *ot)
{
WM_OT_radial_control_partial(ot);
ot->name= "Sculpt Radial Control";
ot->idname= "SCULPT_OT_radial_control";
ot->invoke= sculpt_radial_control_invoke;
ot->modal= sculpt_radial_control_modal;
ot->exec= sculpt_radial_control_exec;
ot->poll= sculpt_poll;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
}
/**** Operator for applying a stroke (various attributes including mouse path)
using the current brush. ****/
@ -3784,7 +3725,6 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot)
void ED_operatortypes_sculpt(void)
{
WM_operatortype_append(SCULPT_OT_radial_control);
WM_operatortype_append(SCULPT_OT_brush_stroke);
WM_operatortype_append(SCULPT_OT_sculptmode_toggle);
WM_operatortype_append(SCULPT_OT_set_persistent_base);

View File

@ -998,10 +998,14 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
y2= viewborder.ymax;
/* apply offsets so the real 3D camera shows through */
x1i= (int)(x1 - 1.0f);
y1i= (int)(y1 - 1.0f);
x2i= (int)(x2 + 1.0f);
y2i= (int)(y2 + 1.0f);
/* note: quite un-scientific but without this bit extra
* 0.0001 on the lower left the 2D border sometimes
* obscures the 3D camera border */
x1i= (int)(x1 - 1.0001f);
y1i= (int)(y1 - 1.0001f);
x2i= (int)(x2 + (1.0f-0.0001f));
y2i= (int)(y2 + (1.0f-0.0001f));
/* passepartout, specified in camera edit buttons */
if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) {

View File

@ -317,10 +317,4 @@ typedef struct wmOperator {
/* wmOperator flag */
#define OP_GRAB_POINTER 1
typedef enum wmRadialControlMode {
WM_RADIALCONTROL_SIZE,
WM_RADIALCONTROL_STRENGTH,
WM_RADIALCONTROL_ANGLE
} wmRadialControlMode;
#endif /* DNA_WINDOWMANAGER_TYPES_H */

View File

@ -481,12 +481,12 @@ static void rna_def_particle_edit(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "ParticleBrushData");
RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
RNA_def_property_range(prop, 1, SHRT_MAX);
RNA_def_property_ui_range(prop, 1, 100, 10, 3);
RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.001, 1.0);
RNA_def_property_ui_text(prop, "Strength", "Brush strength");

View File

@ -212,7 +212,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "strength");
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2);
RNA_def_property_ui_text(prop, "Strength", "Strength of wavelet noise");
RNA_def_property_ui_text(prop, "Strength", "Strength of noise");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
prop= RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);

View File

@ -508,6 +508,27 @@ static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *C, P
return item;
}
static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values)
{
SpaceImage *sima= (SpaceImage*)ptr->data;
ScrArea *sa;
ARegion *ar;
values[0] = values[1] = 1;
sa = rna_area_from_space(ptr);
if(!sa) return;
/* find aregion */
for(ar=sa->regionbase.first; ar; ar=ar->next) {
if(ar->regiontype == RGN_TYPE_WINDOW)
break;
}
if(!ar) return;
ED_space_image_zoom(sima, ar, &values[0], &values[1]);
}
static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values)
{
SpaceImage *sima= (SpaceImage*)ptr->data;
@ -1556,6 +1577,12 @@ static void rna_def_space_image(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "sample_line_hist");
RNA_def_property_struct_type(prop, "Histogram");
RNA_def_property_ui_text(prop, "Line sample", "Sampled colors along line");
prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 2);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_zoom_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Zoom", "Zoom factor");
/* image draw */
prop= RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE);

View File

@ -1,87 +0,0 @@
/*
* $Id$
*
* ***** 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,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*
*/
#ifndef BLO_READBLENFILE_H
#define BLO_READBLENFILE_H
/** \file BLO_readblenfile.h
* \ingroup blo
*/
#ifdef __cplusplus
extern "C" {
#endif
struct ReportList;
BlendFileData *
BLO_readblenfilename(
char *fileName,
struct ReportList *reports);
BlendFileData *
BLO_readblenfilehandle(
int fileHandle,
struct ReportList *reports);
BlendFileData *
BLO_readblenfilememory(
char *fromBuffer,
int fromBufferSize,
struct ReportList *reports);
void
BLO_setcurrentversionnumber(
char array[4]);
void
BLO_setversionnumber(
char array[4],
int version);
int
blo_is_a_runtime(
char *file);
BlendFileData *
blo_read_runtime(
char *file,
struct ReportList *reports);
#define BLO_RESERVEDSIZE 12
extern const char *headerMagic;
#ifdef __cplusplus
}
#endif
#endif /* BLO_READBLENFILE_H */

View File

@ -1,42 +0,0 @@
# $Id$
# ***** 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,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): Jacques Beaurain.
#
# ***** END GPL LICENSE BLOCK *****
set(INC
.
../blenloader
../blenloader/intern
../blenkernel
../blenlib
../makesdna
)
set(SRC
intern/BLO_readblenfile.c
BLO_readblenfile.h
)
blender_add_lib(bf_readblenfile "${SRC}" "${INC}")

View File

@ -1,8 +0,0 @@
#!/usr/bin/python
Import ('env')
sources = env.Glob('intern/*.c')
incs = '. ../blenloader ../blenloader/intern ../blenkernel ../blenlib ../makesdna'
env.BlenderLib ( 'bf_readblenfile', sources, Split(incs), [], libtype=['core','player'], priority = [0,5] )

View File

@ -1,97 +0,0 @@
/*
* $Id$
*
* ***** 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,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*
*/
/** \file blender/readblenfile/stub/BLO_readblenfileSTUB.c
* \ingroup blo
*/
#include <stdio.h>
int BLO_readblenfilememory( char *fromBuffer, int fromBufferSize);
int BLO_readblenfilename( char *fileName);
int BLO_readblenfilehandle( int fileHandle);
int BLO_is_a_runtime( char *file);
int BLO_read_runtime( char *file);
int
BLO_readblenfilememory(
char *fromBuffer, int fromBufferSize)
{
#if defined(DEBUG)
fprintf(stderr,
"Error BLO_readblenfilename is a stub\n");
#endif
return(1);
}
int
BLO_readblenfilename(
char *fileName)
{
#if defined(DEBUG)
fprintf(stderr,
"Error BLO_readblenfilename is a stub\n");
#endif
return(1);
}
int
BLO_readblenfilehandle(
int fileHandle)
{
#if defined(DEBUG)
fprintf(stderr,
"Error BLO_readblenfilehandle is a stub\n");
#endif
return(1);
}
int
BLO_is_a_runtime(
char *file)
{
#if defined(DEBUG)
fprintf(stderr,
"Error BLO_is_a_runtime is a stub\n");
#endif
return 0;
}
int
BLO_read_runtime(
char *file)
{
#if defined(DEBUG)
fprintf(stderr,
"Error BLO_read_runtime is a stub\n");
#endif
return 0;
}

View File

@ -293,12 +293,6 @@ struct wmGesture *WM_gesture_new(struct bContext *C, struct wmEvent *event, int
void WM_gesture_end(struct bContext *C, struct wmGesture *gesture);
void WM_gestures_remove(struct bContext *C);
/* radial control operator */
int WM_radial_control_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
int WM_radial_control_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
void WM_OT_radial_control_partial(struct wmOperatorType *ot);
void WM_radial_control_string(struct wmOperator *op, char str[], int maxlen);
/* fileselecting support */
void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op);
void WM_event_fileselect_event(struct bContext *C, void *ophandle, int eventval);

View File

@ -61,6 +61,7 @@
#include "BLO_readfile.h"
#include "BKE_blender.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_idprop.h"
@ -2674,272 +2675,465 @@ void WM_OT_straightline_gesture(wmOperatorType *ot)
static const int WM_RADIAL_CONTROL_DISPLAY_SIZE = 200;
typedef struct wmRadialControl {
int mode;
float initial_value, value, max_value;
float col[4], tex_col[4];
typedef struct {
PropertyType type;
PropertySubType subtype;
PointerRNA ptr, col_ptr, fill_col_ptr, rot_ptr, zoom_ptr, image_id_ptr;
PropertyRNA *prop, *col_prop, *fill_col_prop, *rot_prop, *zoom_prop;
StructRNA *image_id_srna;
float initial_value, current_value, min_value, max_value;
int initial_mouse[2];
unsigned int gltex;
ListBase orig_paintcursors;
void *cursor;
GLuint tex;
} wmRadialControl;
} RadialControl;
static void wm_radial_control_paint(bContext *C, int x, int y, void *customdata)
static void radial_control_set_initial_mouse(RadialControl *rc, wmEvent *event)
{
wmRadialControl *rc = (wmRadialControl*)customdata;
float d[2] = {0, 0};
float zoom[2] = {1, 1};
rc->initial_mouse[0]= event->x;
rc->initial_mouse[1]= event->y;
switch(rc->subtype) {
case PROP_DISTANCE:
d[0] = rc->initial_value;
break;
case PROP_FACTOR:
d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * (1 - rc->initial_value);
break;
case PROP_ANGLE:
d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(rc->initial_value);
d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(rc->initial_value);
break;
default:
return;
}
if(rc->zoom_prop) {
RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
d[0] *= zoom[0];
d[1] *= zoom[1];
}
rc->initial_mouse[0]-= d[0];
rc->initial_mouse[1]-= d[1];
}
static void radial_control_set_tex(RadialControl *rc)
{
ImBuf *ibuf;
switch(RNA_type_to_ID_code(rc->image_id_ptr.type)) {
case ID_BR:
if((ibuf = brush_gen_radial_control_imbuf(rc->image_id_ptr.data))) {
glGenTextures(1, &rc->gltex);
glBindTexture(GL_TEXTURE_2D, rc->gltex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, ibuf->x, ibuf->y, 0,
GL_ALPHA, GL_FLOAT, ibuf->rect_float);
MEM_freeN(ibuf->rect_float);
MEM_freeN(ibuf);
}
break;
default:
break;
}
}
static void radial_control_paint_tex(RadialControl *rc, float radius, float alpha)
{
float col[3] = {0, 0, 0};
float rot;
/* set fill color */
if(rc->fill_col_prop)
RNA_property_float_get_array(&rc->fill_col_ptr, rc->fill_col_prop, col);
glColor4f(col[0], col[1], col[2], alpha);
if(rc->gltex) {
glBindTexture(GL_TEXTURE_2D, rc->gltex);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
/* set up rotation if available */
if(rc->rot_prop) {
rot = RNA_property_float_get(&rc->rot_ptr, rc->rot_prop);
glPushMatrix();
glRotatef(RAD2DEGF(rot), 0, 0, 1);
}
/* draw textured quad */
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex2f(-radius, -radius);
glTexCoord2f(1,0);
glVertex2f(radius, -radius);
glTexCoord2f(1,1);
glVertex2f(radius, radius);
glTexCoord2f(0,1);
glVertex2f(-radius, radius);
glEnd();
glDisable(GL_TEXTURE_2D);
/* undo rotation */
if(rc->rot_prop)
glPopMatrix();
}
else {
/* flat color if no texture available */
glutil_draw_filled_arc(0, M_PI * 2, radius, 40);
}
}
static void radial_control_paint_cursor(bContext *C, int x, int y, void *customdata)
{
RadialControl *rc = customdata;
ARegion *ar = CTX_wm_region(C);
float r1=0.0f, r2=0.0f, r3=0.0f, angle=0.0f;
float r1=0.0f, r2=0.0f, tex_radius, alpha;
float zoom[2], col[3] = {1, 1, 1};
// int hit = 0;
if(rc->mode == WM_RADIALCONTROL_STRENGTH)
rc->tex_col[3]= (rc->value + 0.5f);
if(rc->mode == WM_RADIALCONTROL_SIZE) {
r1= rc->value;
switch(rc->subtype) {
case PROP_DISTANCE:
r1= rc->current_value;
r2= rc->initial_value;
r3= r1;
} else if(rc->mode == WM_RADIALCONTROL_STRENGTH) {
r1= (1 - rc->value) * WM_RADIAL_CONTROL_DISPLAY_SIZE;
r2= r3= (float)WM_RADIAL_CONTROL_DISPLAY_SIZE;
} else if(rc->mode == WM_RADIALCONTROL_ANGLE) {
r1= r2= r3= (float)WM_RADIAL_CONTROL_DISPLAY_SIZE;
angle = rc->value;
tex_radius= r1;
alpha = 0.75;
break;
case PROP_FACTOR:
r1= (1 - rc->current_value) * WM_RADIAL_CONTROL_DISPLAY_SIZE;
r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE;
alpha = rc->current_value / 2 + 0.5;
break;
case PROP_ANGLE:
r1= r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE;
alpha = 0.75;
break;
default:
break;
}
/* Keep cursor in the original place */
x = rc->initial_mouse[0] - ar->winrct.xmin;
y = rc->initial_mouse[1] - ar->winrct.ymin;
glTranslatef((float)x, (float)y, 0.0f);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
if(rc->mode == WM_RADIALCONTROL_ANGLE) {
glRotatef(angle, 0, 0, 1);
/* apply zoom if available */
if(rc->zoom_prop) {
RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
glScalef(zoom[0], zoom[1], 1);
}
if (rc->tex) {
glBindTexture(GL_TEXTURE_2D, rc->tex);
/* draw rotated texture */
radial_control_paint_tex(rc, tex_radius, alpha);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
/* set line color */
if(rc->col_prop)
RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col);
glColor4f(col[0], col[1], col[2], 0.5);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glColor4fv(rc->tex_col);
glTexCoord2f(0,0);
glVertex2f(-r3, -r3);
glTexCoord2f(1,0);
glVertex2f(r3, -r3);
glTexCoord2f(1,1);
glVertex2f(r3, r3);
glTexCoord2f(0,1);
glVertex2f(-r3, r3);
glEnd();
glDisable(GL_TEXTURE_2D);
}
if(rc->mode == WM_RADIALCONTROL_ANGLE) {
glColor4fv(rc->col);
glEnable(GL_LINE_SMOOTH);
glRotatef(-angle, 0, 0, 1);
if(rc->subtype == PROP_ANGLE) {
glPushMatrix();
/* draw original angle line */
glRotatef(RAD2DEGF(rc->initial_value), 0, 0, 1);
fdrawline(0.0f, 0.0f, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
glRotatef(angle, 0, 0, 1);
/* draw new angle line */
glRotatef(RAD2DEGF(rc->current_value - rc->initial_value), 0, 0, 1);
fdrawline(0.0f, 0.0f, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
glDisable(GL_LINE_SMOOTH);
glPopMatrix();
}
glColor4fv(rc->col);
/* draw circles on top */
glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r1, 40);
glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r2, 40);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
}
int WM_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
/* attempt to retrieve the rna pointer/property from an rna path;
returns 0 for failure, 1 for success, and also 1 if property is not
set */
static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
const char *name, PointerRNA *r_ptr,
PropertyRNA **r_prop, int req_float,
int req_length, int allow_missing)
{
wmRadialControl *rc = (wmRadialControl*)op->customdata;
int mode, initial_mouse[2], delta[2];
float dist;
double new_value = RNA_float_get(op->ptr, "new_value");
int ret = OPERATOR_RUNNING_MODAL;
// float initial_value = RNA_float_get(op->ptr, "initial_value");
PropertyRNA *unused_prop;
int len;
char *str;
mode = RNA_enum_get(op->ptr, "mode");
RNA_int_get_array(op->ptr, "initial_mouse", initial_mouse);
/* get an rna string path from the operator's properties */
if(!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0)))
return 1;
if(str[0] == '\0') {
MEM_freeN(str);
return 1;
}
if(!r_prop)
r_prop = &unused_prop;
/* get rna from path */
if(!RNA_path_resolve(ctx_ptr, str, r_ptr, r_prop)) {
MEM_freeN(str);
if(allow_missing)
return 1;
else {
BKE_reportf(op->reports, RPT_ERROR, "Couldn't resolve path %s", name);
return 0;
}
}
/* if property is expected to be a float, check its type */
if(req_float) {
if(!(*r_prop) || (RNA_property_type(*r_prop) != PROP_FLOAT)) {
MEM_freeN(str);
BKE_reportf(op->reports, RPT_ERROR,
"Property from path %s is not a float", name);
return 0;
}
}
/* check property's array length */
if(*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_length) {
MEM_freeN(str);
BKE_reportf(op->reports, RPT_ERROR,
"Property from path %s has length %d instead of %d",
name, len, req_length);
return 0;
}
/* success */
MEM_freeN(str);
return 1;
}
/* initialize the rna pointers and properties using rna paths */
static int radial_control_get_properties(bContext *C, wmOperator *op)
{
RadialControl *rc = op->customdata;
PointerRNA ctx_ptr;
RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr);
if(!radial_control_get_path(&ctx_ptr, op, "data_path", &rc->ptr, &rc->prop, 0, 0, 0))
return 0;
/* data path is required */
if(!rc->prop)
return 0;
if(!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 1, 0, 0))
return 0;
if(!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 1, 3, 0))
return 0;
if(!radial_control_get_path(&ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 1, 3, 0))
return 0;
/* slightly ugly; allow this property to not resolve
correctly. needed because 3d texture paint shares the same
keymap as 2d image paint */
if(!radial_control_get_path(&ctx_ptr, op, "zoom_path", &rc->zoom_ptr, &rc->zoom_prop, 1, 2, 1))
return 0;
if(!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0, 0))
return 0;
else if(rc->image_id_ptr.data) {
/* extra check, pointer must be to an ID */
if(!RNA_struct_is_ID(rc->image_id_ptr.type)) {
BKE_report(op->reports, RPT_ERROR,
"Pointer from path image_id is not an ID");
return 0;
}
}
return 1;
}
static int radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
wmWindowManager *wm;
RadialControl *rc;
int min_value_int, max_value_int, step_int;
float step_float, precision;
if(!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl")))
return OPERATOR_CANCELLED;
if(!radial_control_get_properties(C, op)) {
MEM_freeN(rc);
return OPERATOR_CANCELLED;
}
/* get type, initial, min, and max values of the property */
switch((rc->type = RNA_property_type(rc->prop))) {
case PROP_INT:
rc->initial_value = RNA_property_int_get(&rc->ptr, rc->prop);
RNA_property_int_ui_range(&rc->ptr, rc->prop, &min_value_int,
&max_value_int, &step_int);
rc->min_value = min_value_int;
rc->max_value = max_value_int;
break;
case PROP_FLOAT:
rc->initial_value = RNA_property_float_get(&rc->ptr, rc->prop);
RNA_property_float_ui_range(&rc->ptr, rc->prop, &rc->min_value,
&rc->max_value, &step_float, &precision);
break;
default:
BKE_report(op->reports, RPT_ERROR, "Property must be an integer or a float");
MEM_freeN(rc);
return OPERATOR_CANCELLED;
}
/* get subtype of property */
rc->subtype = RNA_property_subtype(rc->prop);
if(!ELEM3(rc->subtype, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) {
BKE_report(op->reports, RPT_ERROR, "Property must be a distance, a factor, or an angle");
MEM_freeN(rc);
return OPERATOR_CANCELLED;
}
rc->current_value = rc->initial_value;
radial_control_set_initial_mouse(rc, event);
radial_control_set_tex(rc);
/* temporarily disable other paint cursors */
wm = CTX_wm_manager(C);
rc->orig_paintcursors = wm->paintcursors;
wm->paintcursors.first = wm->paintcursors.last = NULL;
/* add radial control paint cursor */
rc->cursor = WM_paint_cursor_activate(wm, op->type->poll,
radial_control_paint_cursor, rc);
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
static void radial_control_set_value(RadialControl *rc, float val)
{
switch(rc->type) {
case PROP_INT:
RNA_property_int_set(&rc->ptr, rc->prop, val);
break;
case PROP_FLOAT:
RNA_property_float_set(&rc->ptr, rc->prop, val);
break;
default:
break;
}
}
static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
{
RadialControl *rc = op->customdata;
wmWindowManager *wm;
float new_value, dist, zoom[2];
float delta[2], snap, ret = OPERATOR_RUNNING_MODAL;
/* TODO: fix hardcoded events */
snap = event->ctrl;
switch(event->type) {
case MOUSEMOVE:
delta[0]= initial_mouse[0] - event->x;
delta[1]= initial_mouse[1] - event->y;
delta[0]= rc->initial_mouse[0] - event->x;
delta[1]= rc->initial_mouse[1] - event->y;
//if (mode == WM_RADIALCONTROL_SIZE)
// delta[0]+= initial_value;
//else if(mode == WM_RADIALCONTROL_STRENGTH)
// delta[0]+= WM_RADIAL_CONTROL_DISPLAY_SIZE * (1 - initial_value);
//else if(mode == WM_RADIALCONTROL_ANGLE) {
// delta[0]+= WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(initial_value*M_PI/180.0f);
// delta[1]+= WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(initial_value*M_PI/180.0f);
//}
dist= sqrtf(delta[0]*delta[0]+delta[1]*delta[1]);
if(mode == WM_RADIALCONTROL_SIZE)
new_value = dist;
else if(mode == WM_RADIALCONTROL_STRENGTH) {
new_value = 1 - dist / WM_RADIAL_CONTROL_DISPLAY_SIZE;
} else if(mode == WM_RADIALCONTROL_ANGLE)
new_value = ((int)(atan2f(delta[1], delta[0]) * (float)(180.0 / M_PI)) + 180);
if(event->ctrl) {
if(mode == WM_RADIALCONTROL_STRENGTH)
new_value = ((int)ceilf(new_value * 10.f) * 10.0f) / 100.f;
else
new_value = ((int)new_value + 5) / 10*10;
if(rc->zoom_prop) {
RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
delta[0] /= zoom[0];
delta[1] /= zoom[1];
}
dist= sqrt(delta[0]*delta[0]+delta[1]*delta[1]);
/* calculate new value and apply snapping */
switch(rc->subtype) {
case PROP_DISTANCE:
new_value = dist;
if(snap) new_value = ((int)new_value + 5) / 10*10;
break;
case PROP_FACTOR:
new_value = 1 - dist / WM_RADIAL_CONTROL_DISPLAY_SIZE;
if(snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
break;
case PROP_ANGLE:
new_value = atan2(delta[1], delta[0]) + M_PI;
if(snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10*10);
break;
default:
break;
}
/* clamp and update */
CLAMP(new_value, rc->min_value, rc->max_value);
radial_control_set_value(rc, new_value);
rc->current_value = new_value;
break;
case ESCKEY:
case RIGHTMOUSE:
/* cancelled; restore original value */
radial_control_set_value(rc, rc->initial_value);
ret = OPERATOR_CANCELLED;
break;
case LEFTMOUSE:
case PADENTER:
op->type->exec(C, op);
/* done; value already set */
ret = OPERATOR_FINISHED;
break;
}
/* Clamp */
if(new_value > rc->max_value)
new_value = rc->max_value;
else if(new_value < 0)
new_value = 0;
/* Update paint data */
rc->value = (float)new_value;
RNA_float_set(op->ptr, "new_value", rc->value);
if(ret != OPERATOR_RUNNING_MODAL) {
WM_paint_cursor_end(CTX_wm_manager(C), rc->cursor);
MEM_freeN(rc);
}
ED_region_tag_redraw(CTX_wm_region(C));
//if (ret != OPERATOR_RUNNING_MODAL) {
// wmWindow *win = CTX_wm_window(C);
// WM_cursor_restore(win);
//}
if(ret != OPERATOR_RUNNING_MODAL) {
wm = CTX_wm_manager(C);
WM_paint_cursor_end(wm, rc->cursor);
/* restore original paint cursors */
wm->paintcursors = rc->orig_paintcursors;
/* not sure if this is a good notifier to use;
intended purpose is to update the UI so that the
new value is displayed in sliders/numfields */
WM_event_add_notifier(C, NC_WINDOW, NULL);
glDeleteTextures(1, &rc->gltex);
MEM_freeN(rc);
}
return ret;
}
/* Expects the operator customdata to be an ImBuf (or NULL) */
int WM_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void WM_OT_radial_control(wmOperatorType *ot)
{
wmRadialControl *rc = MEM_callocN(sizeof(wmRadialControl), "radial control");
// wmWindow *win = CTX_wm_window(C);
int mode = RNA_enum_get(op->ptr, "mode");
float initial_value = RNA_float_get(op->ptr, "initial_value");
//float initial_size = RNA_float_get(op->ptr, "initial_size");
int mouse[2];
ot->name= "Radial Control";
ot->idname= "WM_OT_radial_control";
mouse[0]= event->x;
mouse[1]= event->y;
ot->invoke= radial_control_invoke;
ot->modal= radial_control_modal;
//if (initial_size == 0)
// initial_size = WM_RADIAL_CONTROL_DISPLAY_SIZE;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
if(mode == WM_RADIALCONTROL_SIZE) {
rc->max_value = 200;
mouse[0]-= (int)initial_value;
}
else if(mode == WM_RADIALCONTROL_STRENGTH) {
rc->max_value = 1;
mouse[0]-= (int)(WM_RADIAL_CONTROL_DISPLAY_SIZE * (1.0f - initial_value));
}
else if(mode == WM_RADIALCONTROL_ANGLE) {
rc->max_value = 360;
mouse[0]-= (int)(WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(initial_value));
mouse[1]-= (int)(WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(initial_value));
initial_value *= 180.0f/(float)M_PI;
}
if(op->customdata) {
ImBuf *im = (ImBuf*)op->customdata;
/* Build GL texture */
glGenTextures(1, &rc->tex);
glBindTexture(GL_TEXTURE_2D, rc->tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, im->x, im->y, 0, GL_ALPHA, GL_FLOAT, im->rect_float);
MEM_freeN(im->rect_float);
MEM_freeN(im);
}
RNA_float_get_array(op->ptr, "color", rc->col);
RNA_float_get_array(op->ptr, "texture_color", rc->tex_col);
RNA_int_set_array(op->ptr, "initial_mouse", mouse);
RNA_float_set(op->ptr, "new_value", initial_value);
op->customdata = rc;
rc->mode = mode;
rc->initial_value = initial_value;
rc->initial_mouse[0] = mouse[0];
rc->initial_mouse[1] = mouse[1];
rc->cursor = WM_paint_cursor_activate(CTX_wm_manager(C), op->type->poll,
wm_radial_control_paint, op->customdata);
//WM_cursor_modal(win, CURSOR_NONE);
/* add modal handler */
WM_event_add_modal_handler(C, op);
WM_radial_control_modal(C, op, event);
return OPERATOR_RUNNING_MODAL;
}
/* Gets a descriptive string of the operation */
void WM_radial_control_string(wmOperator *op, char str[], int maxlen)
{
int mode = RNA_enum_get(op->ptr, "mode");
float v = RNA_float_get(op->ptr, "new_value");
if(mode == WM_RADIALCONTROL_SIZE)
BLI_snprintf(str, maxlen, "Size: %d", (int)v);
else if(mode == WM_RADIALCONTROL_STRENGTH)
BLI_snprintf(str, maxlen, "Strength: %d", (int)v);
else if(mode == WM_RADIALCONTROL_ANGLE)
BLI_snprintf(str, maxlen, "Angle: %d", (int)(v * 180.0f/(float)M_PI));
}
/** Important: this doesn't define an actual operator, it
just sets up the common parts of the radial control op. **/
void WM_OT_radial_control_partial(wmOperatorType *ot)
{
static EnumPropertyItem radial_mode_items[] = {
{WM_RADIALCONTROL_SIZE, "SIZE", 0, "Size", ""},
{WM_RADIALCONTROL_STRENGTH, "STRENGTH", 0, "Strength", ""},
{WM_RADIALCONTROL_ANGLE, "ANGLE", 0, "Angle", ""},
{0, NULL, 0, NULL, NULL}};
static float color[4] = {1.0f, 1.0f, 1.0f, 0.5f};
static float tex_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
/* Should be set in custom invoke() */
RNA_def_float(ot->srna, "initial_value", 0, 0, FLT_MAX, "Initial Value", "", 0, FLT_MAX);
/* Set internally, should be used in custom exec() to get final value */
RNA_def_float(ot->srna, "new_value", 0, 0, FLT_MAX, "New Value", "", 0, FLT_MAX);
/* Should be set before calling operator */
RNA_def_enum(ot->srna, "mode", radial_mode_items, 0, "Mode", "");
/* Internal */
RNA_def_int_vector(ot->srna, "initial_mouse", 2, NULL, INT_MIN, INT_MAX, "Initial Mouse", "", INT_MIN, INT_MAX);
RNA_def_float_color(ot->srna, "color", 4, color, 0.0f, FLT_MAX, "Color", "Radial control color", 0.0f, 1.0f);
RNA_def_float_color(ot->srna, "texture_color", 4, tex_color, 0.0f, FLT_MAX, "Texture Color", "Radial control texture color", 0.0f, 1.0f);
/* all paths relative to the context */
RNA_def_string(ot->srna, "data_path", "", 0, "Data Path", "Path of property to be set by the radial control.");
RNA_def_string(ot->srna, "rotation_path", "", 0, "Rotation Path", "Path of property used to rotate the texture display.");
RNA_def_string(ot->srna, "color_path", "", 0, "Color Path", "Path of property used to set the color of the control.");
RNA_def_string(ot->srna, "fill_color_path", "", 0, "Fill Color Path", "Path of property used to set the fill color of the control.");
RNA_def_string(ot->srna, "zoom_path", "", 0, "Zoom Path", "Path of property used to set the zoom level for the control.");
RNA_def_string(ot->srna, "image_id", "", 0, "Image ID", "Path of ID that is used to generate an image for the control.");
}
/* ************************** timer for testing ***************** */
@ -3133,6 +3327,7 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_splash);
WM_operatortype_append(WM_OT_search_menu);
WM_operatortype_append(WM_OT_call_menu);
WM_operatortype_append(WM_OT_radial_control);
#if defined(WIN32)
WM_operatortype_append(WM_OT_console_toggle);
#endif

View File

@ -128,7 +128,6 @@ endif()
extern_openjpeg
extern_redcode
bf_imbuf_dds
bf_readblenfile
bf_dna
ge_videotex
bf_blenfont

View File

@ -248,6 +248,7 @@ short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, sho
short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag){return 0;}
void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock){}
struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **lock_r){return (struct ImBuf *) NULL;}
void ED_space_image_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy) {}
char *ED_info_stats_string(struct Scene *scene){return (char *) NULL;}
void ED_area_tag_redraw(struct ScrArea *sa){}
void ED_area_tag_refresh(struct ScrArea *sa){}

View File

@ -773,7 +773,6 @@ endif()
bf_imbuf_cineon
bf_imbuf_openexr
bf_imbuf_dds
bf_readblenfile
bf_collada
bf_intern_bsp
bf_intern_bop

View File

@ -39,7 +39,6 @@ set(INC
../../../../source/blender/blenfont
../../../../source/blender/blenlib
../../../../source/blender/blenkernel
../../../../source/blender/readblenfile
../../../../source/blender
../../../../source/blender/makesdna
../../../../source/blender/makesrna

View File

@ -67,7 +67,7 @@ extern "C"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "BLO_readfile.h"
#include "BLO_readblenfile.h"
#include "BLO_runtime.h"
#include "IMB_imbuf.h"
#include "BKE_text.h"
@ -313,8 +313,8 @@ static BlendFileData *load_game_data(char *progname, char *filename = NULL, char
BKE_reports_init(&reports, RPT_STORE);
/* try to load ourself, will only work if we are a runtime */
if (blo_is_a_runtime(progname)) {
bfd= blo_read_runtime(progname, &reports);
if (BLO_is_a_runtime(progname)) {
bfd= BLO_read_runtime(progname, &reports);
if (bfd) {
bfd->type= BLENFILETYPE_RUNTIME;
strcpy(bfd->main->name, progname);
@ -444,7 +444,7 @@ int main(int argc, char** argv)
U.audiochannels = 2;
/* if running blenderplayer the last argument can't be parsed since it has to be the filename. */
isBlenderPlayer = !blo_is_a_runtime(argv[0]);
isBlenderPlayer = !BLO_is_a_runtime(argv[0]);
if (isBlenderPlayer)
validArguments = argc - 1;
else

View File

@ -22,7 +22,6 @@ incs = ['.',
'#source/blender/blenfont',
'#source/blender/blenlib',
'#source/blender/blenkernel',
'#source/blender/readblenfile',
'#source/blender',
'#source/blender/include',
'#source/blender/makesdna',