- bpy.data.sounds was a collection of ID's rather then Sounds

- last commit, missed include for rna_object_api.c & bad args to find_basis_mball
- use enum for GHOST tablet type None/Stylus/Eraser, had duplicate definition for these in C. Only tested X11, may need to cast to an int for other OS's.
This commit is contained in:
Campbell Barton
2009-09-16 15:55:00 +00:00
parent b5b0a62c97
commit 7c5695c801
11 changed files with 23 additions and 20 deletions

View File

@@ -64,8 +64,14 @@ typedef enum
* the pen's angle in 3D space vertically downwards on to the XY plane
* --Matt
*/
typedef enum {
GHOST_kTabletModeNone = 0,
GHOST_kTabletModeStylus,
GHOST_kTabletModeEraser
} GHOST_TTabletMode;
typedef struct GHOST_TabletData {
char Active; /* 0=None, 1=Stylus, 2=Eraser */
GHOST_TTabletMode Active; /* 0=None, 1=Stylus, 2=Eraser */
float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
float Ytilt; /* as above */

View File

@@ -684,12 +684,12 @@ GHOST_SystemX11::processEvent(XEvent *xe)
{
XProximityNotifyEvent* data = (XProximityNotifyEvent*)xe;
if(data->deviceid == window->GetXTablet().StylusID)
window->GetXTablet().CommonData.Active= 1;
window->GetXTablet().CommonData.Active= GHOST_kTabletModeStylus;
else if(data->deviceid == window->GetXTablet().EraserID)
window->GetXTablet().CommonData.Active= 2;
window->GetXTablet().CommonData.Active= GHOST_kTabletModeEraser;
}
else if(xe->type == window->GetXTablet().ProxOutEvent)
window->GetXTablet().CommonData.Active= 0;
window->GetXTablet().CommonData.Active= GHOST_kTabletModeNone;
break;
}

View File

@@ -183,7 +183,7 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
updateDrawingContext();
activateDrawingContext();
m_tablet.Active = 0;
m_tablet.Active = GHOST_kTabletModeNone;
}
}

View File

@@ -244,7 +244,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
m_tablet = fpWTOpen( m_hWnd, &lc, TRUE );
if (m_tablet) {
m_tabletData = new GHOST_TabletData();
m_tabletData->Active = 0;
m_tabletData->Active = GHOST_kTabletModeNone;
}
}
}
@@ -704,7 +704,7 @@ void GHOST_WindowWin32::processWin32TabletInitEvent()
}
}
m_tabletData->Active = 0;
m_tabletData->Active = GHOST_kTabletModeNone;
}
}
}

View File

@@ -425,7 +425,7 @@ void GHOST_WindowX11::initXInputDevices()
XDeviceInfo* device_info = XListInputDevices(m_display, &device_count);
m_xtablet.StylusDevice = 0;
m_xtablet.EraserDevice = 0;
m_xtablet.CommonData.Active= 0;
m_xtablet.CommonData.Active= GHOST_kTabletModeNone;
/* Install our error handler to override Xlib's termination behavior */
old_handler = XSetErrorHandler(ApplicationErrorHandler) ;

View File

@@ -2116,7 +2116,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
wmTabletData *wmtab= event->customdata;
/* de-sensitise based on tablet pressure */
if (ELEM(wmtab->Active, DEV_STYLUS, DEV_ERASER))
if (wmtab->Active != EVT_TABLET_NONE)
fac *= wmtab->Pressure;
}

View File

@@ -259,9 +259,9 @@ void RNA_def_main(BlenderRNA *brna)
{"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks.", NULL, NULL},
{"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks.", NULL, NULL},
{"keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks.", NULL, NULL},
{"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks.", NULL, NULL},
{"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks (DEPRECATED).", NULL, NULL},
{"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks.", NULL, NULL},
{"sounds", "ID", "rna_Main_sound_begin", "Sounds", "Sound datablocks.", NULL, NULL},
{"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks.", NULL, NULL},
{"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks.", NULL, NULL},
{"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks.", NULL, NULL},
{"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks.", NULL, NULL},

View File

@@ -40,6 +40,7 @@
#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
#include "BKE_object.h"
#include "BKE_mball.h"
#include "BKE_main.h"
#include "DNA_mesh_types.h"
@@ -101,7 +102,7 @@ static Mesh *rna_Object_create_render_mesh(Object *ob, bContext *C, Scene *scene
}
case OB_MBALL:
/* metaballs don't have modifiers, so just convert to mesh */
ob = find_basis_mball( ob );
ob = find_basis_mball(scene, ob);
/* todo, re-generatre for render-res */
// metaball_polygonize(scene, ob)
me = add_mesh("Mesh");

View File

@@ -276,12 +276,8 @@ typedef struct wmGesture {
} wmGesture;
/* ************** custom wmEvent data ************** */
#define DEV_STYLUS 1
#define DEV_ERASER 2
typedef struct wmTabletData {
int Active; /* 0=None, 1=Stylus, 2=Eraser */
int Active; /* 0=EVT_TABLET_NONE, 1=EVT_TABLET_STYLUS, 2=EVT_TABLET_ERASER */
float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
float Ytilt; /* as above */

View File

@@ -1498,10 +1498,10 @@ static void update_tablet_data(wmWindow *win, wmEvent *event)
const GHOST_TabletData *td= GHOST_GetTabletData(win->ghostwin);
/* if there's tablet data from an active tablet device then add it */
if ((td != NULL) && td->Active) {
if ((td != NULL) && td->Active != GHOST_kTabletModeNone) {
struct wmTabletData *wmtab= MEM_mallocN(sizeof(wmTabletData), "customdata tablet");
wmtab->Active = td->Active;
wmtab->Active = (int)td->Active;
wmtab->Pressure = td->Pressure;
wmtab->Xtilt = td->Xtilt;
wmtab->Ytilt = td->Ytilt;

View File

@@ -40,7 +40,7 @@
#define EVT_DATA_GESTURE 2
#define EVT_DATA_TIMER 3
/* tablet active */
/* tablet active, matches GHOST_TTabletMode */
#define EVT_TABLET_NONE 0
#define EVT_TABLET_STYLUS 1
#define EVT_TABLET_ERASER 2