svn merge ^/trunk/blender -r49167:49175
This commit is contained in:
@@ -182,7 +182,7 @@ struct Sequence *BKE_sequencer_active_get(struct Scene *scene);
|
||||
int BKE_sequencer_active_get_pair(struct Scene *scene,
|
||||
struct Sequence **seq_act, struct Sequence **seq_other);
|
||||
void BKE_sequencer_active_set(struct Scene *scene, struct Sequence *seq);
|
||||
|
||||
struct Mask *BKE_sequencer_mask_get(struct Scene *scene);
|
||||
|
||||
/* apply functions recursively */
|
||||
int seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg);
|
||||
|
||||
@@ -370,8 +370,15 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru
|
||||
{
|
||||
PointerRNA ptr = CTX_data_pointer_get(C, member);
|
||||
|
||||
if (ptr.data && RNA_struct_is_a(ptr.type, type))
|
||||
return ptr;
|
||||
if (ptr.data) {
|
||||
if (RNA_struct_is_a(ptr.type, type)) {
|
||||
return ptr;
|
||||
}
|
||||
else {
|
||||
printf("%s: warning, member '%s' is '%s', not '%s'\n",
|
||||
__func__, member, RNA_struct_identifier(ptr.type), RNA_struct_identifier(type));
|
||||
}
|
||||
}
|
||||
|
||||
return PointerRNA_NULL;
|
||||
}
|
||||
|
||||
@@ -3810,6 +3810,18 @@ int BKE_sequencer_active_get_pair(Scene *scene, Sequence **seq_act, Sequence **s
|
||||
}
|
||||
}
|
||||
|
||||
Mask *BKE_sequencer_mask_get(Scene *scene)
|
||||
{
|
||||
Sequence *seq_act = BKE_sequencer_active_get(scene);
|
||||
|
||||
if (seq_act && seq_act->type == SEQ_TYPE_MASK) {
|
||||
return seq_act->mask;
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* api like funcs for adding */
|
||||
|
||||
void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
|
||||
|
||||
@@ -29,10 +29,15 @@
|
||||
|
||||
struct Scene;
|
||||
struct Sequence;
|
||||
struct SpaceSeq;
|
||||
|
||||
void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, int deselect_all);
|
||||
void ED_sequencer_deselect_all(struct Scene *scene);
|
||||
|
||||
int ED_space_sequencer_maskedit_mask_poll(struct bContext *C);
|
||||
int ED_space_sequencer_check_show_maskedit(struct SpaceSeq *sseq, struct Scene *scene);
|
||||
int ED_space_sequencer_maskedit_poll(bContext *C);
|
||||
|
||||
void ED_operatormacros_sequencer(void);
|
||||
|
||||
#endif /* __ED_SEQUENCER_H__ */
|
||||
|
||||
@@ -129,7 +129,8 @@ static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline,
|
||||
if (!spline->tot_point)
|
||||
return;
|
||||
|
||||
hsize = UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE);
|
||||
/* TODO, add this to sequence editor */
|
||||
hsize = 4; /* UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE); */
|
||||
|
||||
glPointSize(hsize);
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "ED_mask.h" /* own include */
|
||||
#include "ED_object.h" /* ED_keymap_proportional_maskmode only */
|
||||
#include "ED_clip.h"
|
||||
#include "ED_sequencer.h"
|
||||
#include "ED_transform.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
@@ -54,23 +55,29 @@
|
||||
|
||||
int ED_maskedit_poll(bContext *C)
|
||||
{
|
||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||
|
||||
if (sc) {
|
||||
return ED_space_clip_maskedit_poll(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
if (sa) {
|
||||
switch (sa->spacetype) {
|
||||
case SPACE_CLIP:
|
||||
return ED_space_clip_maskedit_poll(C);
|
||||
case SPACE_SEQ:
|
||||
return ED_space_sequencer_maskedit_poll(C);
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int ED_maskedit_mask_poll(bContext *C)
|
||||
{
|
||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||
|
||||
if (sc) {
|
||||
return ED_space_clip_maskedit_mask_poll(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
if (sa) {
|
||||
switch (sa->spacetype) {
|
||||
case SPACE_CLIP:
|
||||
return ED_space_clip_maskedit_mask_poll(C);
|
||||
case SPACE_SEQ:
|
||||
return ED_space_sequencer_maskedit_mask_poll(C);
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1072,10 +1072,10 @@ static void clip_main_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
|
||||
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
|
||||
|
||||
/* own keymap */
|
||||
keymap = WM_keymap_find(wm->defaultconf, "Mask Editing", 0, 0);
|
||||
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
||||
|
||||
/* own keymap */
|
||||
keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
|
||||
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
||||
|
||||
|
||||
@@ -796,8 +796,15 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
|
||||
bNode *node;
|
||||
|
||||
/* make sure nothing has group editing on */
|
||||
for (node = snode->nodetree->nodes.first; node; node = node->next)
|
||||
for (node = snode->nodetree->nodes.first; node; node = node->next) {
|
||||
nodeGroupEditClear(node);
|
||||
|
||||
/* while we're here, clear texture active */
|
||||
if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
|
||||
/* this is not 100% sure to be reliable, see comment on the flag */
|
||||
node->flag &= ~NODE_ACTIVE_TEXTURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (gnode == NULL) {
|
||||
/* with NULL argument we do a toggle */
|
||||
@@ -809,8 +816,14 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
|
||||
snode->edittree = nodeGroupEditSet(gnode, 1);
|
||||
|
||||
/* deselect all other nodes, so we can also do grabbing of entire subtree */
|
||||
for (node = snode->nodetree->nodes.first; node; node = node->next)
|
||||
for (node = snode->nodetree->nodes.first; node; node = node->next) {
|
||||
node_deselect(node);
|
||||
|
||||
if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
|
||||
/* this is not 100% sure to be reliable, see comment on the flag */
|
||||
node->flag &= ~NODE_ACTIVE_TEXTURE;
|
||||
}
|
||||
}
|
||||
node_select(gnode);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -802,6 +802,61 @@ static void UNUSED_FUNCTION(set_special_seq_update) (int val)
|
||||
else special_seq_update = NULL;
|
||||
}
|
||||
|
||||
static void sequencer_main_area_draw_mask(const bContext *C, Scene *scene, ARegion *ar)
|
||||
{
|
||||
Mask *mask = BKE_sequencer_mask_get(scene);
|
||||
|
||||
if (mask) {
|
||||
struct View2D *v2d = &ar->v2d;
|
||||
|
||||
int x, y;
|
||||
int width, height;
|
||||
float zoomx, zoomy;
|
||||
|
||||
/* frame image */
|
||||
float maxdim;
|
||||
float xofs, yofs;
|
||||
|
||||
/* find window pixel coordinates of origin */
|
||||
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
|
||||
|
||||
width = v2d->tot.xmax - v2d->tot.xmin;
|
||||
height = v2d->tot.ymax - v2d->tot.ymin;
|
||||
|
||||
zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin));
|
||||
zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin));
|
||||
|
||||
x += v2d->tot.xmin * zoomx;
|
||||
y += v2d->tot.ymin * zoomy;
|
||||
|
||||
/* frame the image */
|
||||
maxdim = maxf(width, height);
|
||||
if (width == height) {
|
||||
xofs = yofs = 0;
|
||||
}
|
||||
else if (width < height) {
|
||||
xofs = ((height - width) / -2.0f) * zoomx;
|
||||
yofs = 0.0f;
|
||||
}
|
||||
else { /* (width > height) */
|
||||
xofs = 0.0f;
|
||||
yofs = ((width - height) / -2.0f) * zoomy;
|
||||
}
|
||||
|
||||
/* apply transformation so mask editing tools will assume drawing from the origin in normalized space */
|
||||
glPushMatrix();
|
||||
glTranslatef(x + xofs, y + yofs, 0);
|
||||
glScalef(maxdim * zoomx, maxdim * zoomy, 0);
|
||||
|
||||
ED_mask_draw((bContext *)C, 0, 0); // sc->mask_draw_flag, sc->mask_draw_type
|
||||
|
||||
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs)
|
||||
{
|
||||
struct Main *bmain = CTX_data_main(C);
|
||||
@@ -1009,54 +1064,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
|
||||
|
||||
//if (sc->mode == SC_MODE_MASKEDIT) {
|
||||
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
|
||||
Sequence *seq_act = BKE_sequencer_active_get(scene);
|
||||
|
||||
if (seq_act && seq_act->type == SEQ_TYPE_MASK && seq_act->mask) {
|
||||
int x, y;
|
||||
int width, height;
|
||||
float zoomx, zoomy;
|
||||
|
||||
/* frame image */
|
||||
float maxdim;
|
||||
float xofs, yofs;
|
||||
|
||||
/* find window pixel coordinates of origin */
|
||||
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
|
||||
|
||||
width = v2d->tot.xmax - v2d->tot.xmin;
|
||||
height = v2d->tot.ymax - v2d->tot.ymin;
|
||||
|
||||
zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin));
|
||||
zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin));
|
||||
|
||||
x += v2d->tot.xmin * zoomx;
|
||||
y += v2d->tot.ymin * zoomy;
|
||||
|
||||
/* frame the image */
|
||||
maxdim = maxf(width, height);
|
||||
if (width == height) {
|
||||
xofs = yofs = 0;
|
||||
}
|
||||
else if (width < height) {
|
||||
xofs = ((height - width) / -2.0f) * zoomx;
|
||||
yofs = 0.0f;
|
||||
}
|
||||
else { /* (width > height) */
|
||||
xofs = 0.0f;
|
||||
yofs = ((width - height) / -2.0f) * zoomy;
|
||||
}
|
||||
|
||||
/* apply transformation so mask editing tools will assume drawing from the origin in normalized space */
|
||||
glPushMatrix();
|
||||
glTranslatef(x + xofs, y + yofs, 0);
|
||||
glScalef(maxdim * zoomx, maxdim * zoomy, 0);
|
||||
|
||||
ED_mask_draw((bContext *)C, 0, 0); // sc->mask_draw_flag, sc->mask_draw_type
|
||||
|
||||
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
sequencer_main_area_draw_mask(C, scene, ar);
|
||||
}
|
||||
|
||||
if (cache_handle)
|
||||
|
||||
@@ -466,6 +466,33 @@ void recurs_sel_seq(Sequence *seqm)
|
||||
}
|
||||
}
|
||||
|
||||
int ED_space_sequencer_maskedit_mask_poll(bContext *C)
|
||||
{
|
||||
/* in this case both funcs are the same, for clip editor not */
|
||||
return ED_space_sequencer_maskedit_poll(C);
|
||||
}
|
||||
|
||||
int ED_space_sequencer_check_show_maskedit(SpaceSeq *sseq, Scene *scene)
|
||||
{
|
||||
if (sseq && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
|
||||
return (BKE_sequencer_mask_get(scene) != NULL);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int ED_space_sequencer_maskedit_poll(bContext *C)
|
||||
{
|
||||
SpaceSeq *sseq = CTX_wm_space_seq(C);
|
||||
|
||||
if (sseq) {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
return ED_space_sequencer_check_show_maskedit(sseq, scene);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, const char **error_str)
|
||||
{
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
||||
|
||||
@@ -300,7 +300,10 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
ListBase *lb;
|
||||
|
||||
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
|
||||
|
||||
|
||||
// keymap = WM_keymap_find(wm->defaultconf, "Mask Editing", 0, 0);
|
||||
// WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
||||
|
||||
keymap = WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
|
||||
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
||||
|
||||
@@ -409,9 +412,9 @@ static int sequencer_context(const bContext *C, const char *member, bContextData
|
||||
return TRUE;
|
||||
}
|
||||
else if (CTX_data_equals(member, "edit_mask")) {
|
||||
Sequence *seq_act = BKE_sequencer_active_get(scene);
|
||||
if (seq_act && seq_act->type == SEQ_TYPE_MASK && seq_act->mask) {
|
||||
CTX_data_id_pointer_set(result, &seq_act->mask->id);
|
||||
Mask *mask = BKE_sequencer_mask_get(scene);
|
||||
if (mask) {
|
||||
CTX_data_id_pointer_set(result, &mask->id);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -468,6 +471,9 @@ static void sequencer_preview_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
|
||||
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
|
||||
|
||||
// keymap = WM_keymap_find(wm->defaultconf, "Mask Editing", 0, 0);
|
||||
// WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
||||
|
||||
keymap = WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
|
||||
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
||||
|
||||
|
||||
@@ -211,6 +211,11 @@ typedef struct bNode {
|
||||
/* automatic flag for nodes included in transforms */
|
||||
#define NODE_TRANSFORM (1<<13)
|
||||
/* node is active texture */
|
||||
|
||||
/* note: take care with this flag since its possible it gets
|
||||
* `stuck` inside/outside the active group - which makes buttons
|
||||
* window texture not update, we try to avoid it by clearing the
|
||||
* flag when toggling group editing - Campbell */
|
||||
#define NODE_ACTIVE_TEXTURE (1<<14)
|
||||
/* use a custom color for the node */
|
||||
#define NODE_CUSTOM_COLOR (1<<15)
|
||||
|
||||
@@ -6736,20 +6736,24 @@ static int rna_function_arg_count(FunctionRNA *func)
|
||||
return count;
|
||||
}
|
||||
|
||||
static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_function)
|
||||
static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, void *py_data, int *have_function)
|
||||
{
|
||||
const ListBase *lb;
|
||||
Link *link;
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *prop;
|
||||
StructRNA *srna = dummyptr->type;
|
||||
const char *class_type = RNA_struct_identifier(srna);
|
||||
StructRNA *srna_base = RNA_struct_base(srna);
|
||||
PyObject *py_class = (PyObject *)py_data;
|
||||
PyObject *base_class = RNA_struct_py_type_get(srna);
|
||||
PyObject *item;
|
||||
int i, flag, arg_count, func_arg_count;
|
||||
const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; // __name__
|
||||
|
||||
if (srna_base) {
|
||||
if (bpy_class_validate_recursive(dummyptr, srna_base, py_data, have_function) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (base_class) {
|
||||
if (!PyObject_IsSubclass(py_class, base_class)) {
|
||||
@@ -6884,6 +6888,11 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_function)
|
||||
{
|
||||
return bpy_class_validate_recursive(dummyptr, dummyptr->type, py_data, have_function);
|
||||
}
|
||||
|
||||
/* TODO - multiple return values like with rna functions */
|
||||
static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
* \ingroup ketsji
|
||||
*/
|
||||
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
#include "KX_CameraActuator.h"
|
||||
#include <iostream>
|
||||
@@ -42,8 +43,6 @@
|
||||
|
||||
#include "PyObjectPlus.h"
|
||||
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Native functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user