X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fpython%2Ftags.c;h=17db3e2de0900f6d9c5e7f513b617c5b67a21884;hb=345f8f47f72e16c0c70c1dc89f3b65e873cb1738;hp=2196b990c7aa471e824c30a9f0af502aeb2e2ff1;hpb=65e939c7007091488c5bb881d5b5d847db2ff42d;p=swftools.git diff --git a/lib/python/tags.c b/lib/python/tags.c index 2196b99..17db3e2 100644 --- a/lib/python/tags.c +++ b/lib/python/tags.c @@ -83,6 +83,7 @@ static tag_internals_t font_tag = typedef struct _placeobject_internal { SWFPLACEOBJECT* po; + PyObject*character; } placeobject_internal_t; staticforward tag_internals_t placeobject_tag; @@ -96,10 +97,25 @@ static void po_dealloc(tag_internals_t*self) } static int po_parse(tag_internals_t*self) { - placeobject_internal_t*pi = (placeobject_internal_t*)self->data; - /* TODO */ - PyErr_SetString(PyExc_Exception, setError("Placeobject parsing not implemented yet")); - return 0; + placeobject_internal_t*i = (placeobject_internal_t*)self->data; + if(i->po) + return 1; + if(!self->tag) + return 0; + SWFPLACEOBJECT* swfpo = malloc(sizeof(SWFPLACEOBJECT)); + swf_GetPlaceObject(self->tag, swfpo); + i->po = swfpo; + swf_DeleteTag(self->tag);self->tag = 0; + + if(i->po->id) { + i->character = tagmap_id2obj(self->tagmap, i->po->id); + if(i->character) { + Py_INCREF(i->character); + } else { + //PyErr_Clear(); //? + } + } + return 1; } static int po_fillTAG(tag_internals_t*self) { @@ -110,8 +126,17 @@ static int po_fillTAG(tag_internals_t*self) } static PyObject* po_getattr(tag_internals_t*self,char*a) { - placeobject_internal_t*si = (placeobject_internal_t*)self->data; - if(!strcmp(a, "cxform")) { + placeobject_internal_t*i = (placeobject_internal_t*)self->data; + if(!po_parse(self)) + return PY_ERROR("Couldn't parse placeobject"); + if(!strcmp(a, "character")) { + if(!i->character) + return PY_NONE; + Py_INCREF(i->character); //TODO: ?? + return i->character; + } else if(!strcmp(a, "matrix")) { + return f_Matrix2(&i->po->matrix); + } else if(!strcmp(a, "cxform")) { /* TODO */ return 0; }