* Fix for texture->image node not working
+ a few cleanups
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user