From 607d86167c84b97df144e7a4ed0d27466340cae1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 27 Mar 2009 06:06:11 +0000 Subject: * sequencer transform needs t->data not to be freed by postTrans so special_aftertrans_update can use it. * text header needs a static char* so text is not rendered as gibberish. (until labels own their own strings) * epy_doc_gen.py - write out a graphviz representation of the data api. --- source/blender/editors/space_text/text_header.c | 3 +- .../editors/transform/transform_conversions.c | 6 +- .../blender/editors/transform/transform_generics.c | 2 +- source/blender/python/epy_doc_gen.py | 69 ++++++++++++++++++++-- 4 files changed, 71 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index bb9ef5899b3..a72e66e76ee 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -388,7 +388,8 @@ static void header_buttons(const bContext *C, uiLayout *layout) /* file info */ if(text) { - char fname[HEADER_PATH_MAX], headtxt[HEADER_PATH_MAX+17]; + char fname[HEADER_PATH_MAX]; + static char headtxt[HEADER_PATH_MAX+17]; int len; if(text->name) { diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index c0bc87ebb3e..e4c1f8dc3f1 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4386,7 +4386,6 @@ void special_aftertrans_update(TransInfo *t) ListBase *seqbasep= ed->seqbasep; int a; TransData *td= t->data; - TransData2D *td2d= t->data2d; TransDataSeq *tdsq= NULL; Sequence *seq; @@ -4398,7 +4397,7 @@ void special_aftertrans_update(TransInfo *t) Sequence *seq_prev= NULL; /* flush to 2d vector from internally used 3d vector */ - for(a=0; atotal; a++, td++, td2d++) { + for(a=0; atotal; a++, td++) { tdsq= (TransDataSeq *)td->extra; seq= tdsq->seq; @@ -4429,7 +4428,8 @@ void special_aftertrans_update(TransInfo *t) if (t->customData) MEM_freeN(t->customData); - + if (t->data) + MEM_freeN(t->data); // XXX postTrans useually does this } else if (t->spacetype == SPACE_ACTION) { SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 2bc177c4330..574a045bc86 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -841,7 +841,7 @@ void postTrans (TransInfo *t) } /* postTrans can be called when nothing is selected, so data is NULL already */ - if (t->data) { + if (t->data && (t->spacetype != SPACE_SEQ)) { // XXX SEQ Exception is needed because of special_aftertrans_update using t->data int a; /* since ipokeys are optional on objects, we mallocced them per trans-data */ diff --git a/source/blender/python/epy_doc_gen.py b/source/blender/python/epy_doc_gen.py index 9b22312c294..9d4c25dd513 100644 --- a/source/blender/python/epy_doc_gen.py +++ b/source/blender/python/epy_doc_gen.py @@ -246,10 +246,7 @@ def rna2epy(target_path): for rna_refs in rna_references_dict.values(): rna_refs.sort() - structs = [data[2] for data in structs] - - for rna_struct in structs: - # print(type(rna_struct)) + for (rna_base, identifier, rna_struct) in structs: if rna_struct.nested: continue @@ -261,6 +258,70 @@ def rna2epy(target_path): # # We could also just run.... # os.system('epydoc source/blender/python/doc/rna.py -o ./source/blender/python/doc/html -v') + + + # Write graphviz + out= open(target_path.replace('.py', '.dot'), 'w') + out.write('digraph "rna data api" {\n') + out.write('\tnode [style=filled, shape = "box"];\n') + out.write('\toverlap=false;\n') + out.write('\trankdir = LR;\n') + out.write('\tsplines=true;\n') + out.write('\tratio=auto;\n') + + + + out.write('\tsize="10,10"\n') + #out.write('\tpage="8.5,11"\n') + #out.write('\tcenter=""\n') + + def isop(rna_struct): + return '_OT_' in rna_struct.identifier + + + for (rna_base, identifier, rna_struct) in structs: + if isop(rna_struct): + continue + + base = rna_struct.base + + + out.write('\t"%s";\n' % identifier) + + for (rna_base, identifier, rna_struct) in structs: + + if isop(rna_struct): + continue + + base = rna_struct.base + + if base and not isop(base): + out.write('\t"%s" -> "%s" [label="(base)" weight=1.0];\n' % (base.identifier, identifier)) + + nested = rna_struct.nested + if nested and not isop(nested): + out.write('\t"%s" -> "%s" [label="(nested)" weight=1.0];\n' % (nested.identifier, identifier)) + + + + rna_refs= rna_references_dict[identifier] + + for rna_ref_string in rna_refs: + + if '_OT_' in rna_ref_string: + continue + + ref = rna_ref_string.split('.')[-2] + out.write('\t"%s" -> "%s" [label="%s" weight=0.01];\n' % (ref, identifier, rna_ref_string)) + + + + out.write('}\n') + out.close() + + # # We could also just run.... + # os.system('dot source/blender/python/doc/rna.dot -Tsvg -o ./source/blender/python/doc/rna.svg') + def op2epy(target_path): out = open(target_path, 'w') -- cgit v1.2.3