Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2009-11-19 07:50:00 +0300
committerMatt Ebb <matt@mke3.net>2009-11-19 07:50:00 +0300
commit525fbb22d22f0c8b8d5e13440fa1328bd56036db (patch)
treec5674713dc04eef992e25479441cac17e1413b42 /source/blender
parentbf575a1c1622e62bb3e37e57377a5dca4a19e25e (diff)
* Fix for texture->image node not working
+ a few cleanups
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_node/drawnode.c76
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c9
-rw-r--r--source/blender/makesrna/intern/rna_sequence.c18
3 files changed, 12 insertions, 91 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 3cc06b7bbb9..924b4b2563e 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -96,16 +96,6 @@
/* ****************** GENERAL CALLBACKS FOR NODES ***************** */
-static void node_ID_title_cb(bContext *C, void *node_v, void *unused_v)
-{
- bNode *node= node_v;
-
- if(node->id) {
- test_idbutton(node->id->name+2); /* library.c, verifies unique name */
- BLI_strncpy(node->name, node->id->name+2, 21);
- }
-}
-
#if 0
/* XXX not used yet, make compiler happy :) */
static void node_group_alone_cb(bContext *C, void *node_v, void *unused_v)
@@ -518,36 +508,6 @@ static void node_shader_set_butfunc(bNodeType *ntype)
/* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */
-static void node_browse_image_cb(bContext *C, void *ntree_v, void *node_v)
-{
- bNodeTree *ntree= ntree_v;
- bNode *node= node_v;
-
- nodeSetActive(ntree, node);
-
- if(node->menunr<1) return;
- if(node->menunr==32767) { /* code for Load New */
- /// addqueue(curarea->win, UI_BUT_EVENT, B_NODE_LOADIMAGE); XXX
- }
- else {
- if(node->id) node->id->us--;
- node->id= BLI_findlink(&G.main->image, node->menunr-1);
- id_us_plus(node->id);
-
- BLI_strncpy(node->name, node->id->name+2, 21);
-
- NodeTagChanged(ntree, node);
- BKE_image_signal((Image *)node->id, node->storage, IMA_SIGNAL_USER_NEW_IMAGE);
- // addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC); XXX
- }
- node->menunr= 0;
-}
-
-static void node_active_cb(bContext *C, void *ntree_v, void *node_v)
-{
- nodeSetActive(ntree_v, node_v);
-}
-
static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
uiLayout *col;
@@ -1217,41 +1177,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *C, PointerRNA *pt
static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
- uiBlock *block= uiLayoutAbsoluteBlock(layout);
- bNode *node= ptr->data;
- bNodeTree *ntree= ptr->id.data;
- rctf *butr= &node->butr;
- char *strp;
- uiBut *bt;
-
- uiBlockBeginAlign(block);
-
- /* browse button */
- IMAnames_to_pupstring(&strp, NULL, "LOAD NEW %x32767", &(G.main->image), NULL, NULL);
- node->menunr= 0;
- bt= uiDefButS(block, MENU, B_NOP, strp,
- butr->xmin, butr->ymin, 19, 19,
- &node->menunr, 0, 0, 0, 0, "Browses existing choices");
- uiButSetFunc(bt, node_browse_image_cb, ntree, node);
- if(strp) MEM_freeN(strp);
-
- /* Add New button */
- if(node->id==NULL) {
- bt= uiDefBut(block, BUT, B_NODE_LOADIMAGE, "Load New",
- butr->xmin+19, butr->ymin, (short)(butr->xmax-butr->xmin-19.0f), 19,
- NULL, 0.0, 0.0, 0, 0, "Add new Image");
- uiButSetFunc(bt, node_active_cb, ntree, node);
- }
- else {
- /* name button */
- short xmin= (short)butr->xmin, xmax= (short)butr->xmax;
- short width= xmax - xmin - 19;
-
- bt= uiDefBut(block, TEX, B_NOP, "IM:",
- xmin+19, butr->ymin, width, 19,
- node->id->name+2, 0.0, 19.0, 0, 0, "Image name");
- uiButSetFunc(bt, node_ID_title_cb, node, NULL);
- }
+ uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
}
static void node_texture_buts_output(uiLayout *layout, bContext *C, PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index d8bf8cd4158..648bd98bd6c 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1843,11 +1843,20 @@ static void def_tex_image(StructRNA *srna)
{
PropertyRNA *prop;
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ /* is this supposed to be exposed? not sure..
prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "storage");
RNA_def_property_struct_type(prop, "ImageUser");
RNA_def_property_ui_text(prop, "Settings", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+ */
}
static void def_tex_bricks(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_sequence.c b/source/blender/makesrna/intern/rna_sequence.c
index 99696513142..1f9b3b05f94 100644
--- a/source/blender/makesrna/intern/rna_sequence.c
+++ b/source/blender/makesrna/intern/rna_sequence.c
@@ -42,16 +42,6 @@
#ifdef RNA_RUNTIME
-static int rna_SequenceEditor_name_length(PointerRNA *ptr)
-{
- return strlen("Sequence Editor");
-}
-
-static void rna_SequenceEditor_name_get(PointerRNA *ptr, char *str)
-{
- strcpy(str, "Sequence Editor");
-}
-
static void rna_SequenceEditor_start_frame_set(PointerRNA *ptr, int value)
{
Sequence *seq= (Sequence*)ptr->data;
@@ -232,6 +222,8 @@ static char *rna_Sequence_path(PointerRNA *ptr)
*/
if (seq->name+2)
return BLI_sprintfN("sequence_editor.sequences[\"%s\"]", seq->name+2);
+ else
+ return BLI_strdup("");
}
static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter)
@@ -569,12 +561,6 @@ static void rna_def_editor(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
RNA_def_struct_sdna(srna, "Editing");
- prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_SequenceEditor_name_get", "rna_SequenceEditor_name_length", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_struct_name_property(srna, prop);
-
prop= RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
RNA_def_property_struct_type(prop, "Sequence");