Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/space_node.cc
| Show First 20 Lines • Show All 279 Lines • ▼ Show 20 Lines | static SpaceLink *node_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) | ||||
| region->v2d.cur = region->v2d.tot; | region->v2d.cur = region->v2d.tot; | ||||
| region->v2d.min[0] = 1.0f; | region->v2d.min[0] = 1.0f; | ||||
| region->v2d.min[1] = 1.0f; | region->v2d.min[1] = 1.0f; | ||||
| region->v2d.max[0] = 32000.0f; | region->v2d.max[0] = 32000.0f; | ||||
| region->v2d.max[1] = 32000.0f; | region->v2d.max[1] = 32000.0f; | ||||
| region->v2d.minzoom = 0.09f; | region->v2d.minzoom = 0.05f; | ||||
| region->v2d.maxzoom = 2.31f; | region->v2d.maxzoom = 2.31f; | ||||
| region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); | region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); | ||||
| region->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT; | region->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT; | ||||
| region->v2d.keeptot = 0; | region->v2d.keeptot = 0; | ||||
| return (SpaceLink *)snode; | return (SpaceLink *)snode; | ||||
| } | } | ||||
| static void node_free(SpaceLink *sl) | static void node_free(SpaceLink *sl) | ||||
| { | { | ||||
| SpaceNode *snode = (SpaceNode *)sl; | SpaceNode *snode = (SpaceNode *)sl; | ||||
| LISTBASE_FOREACH_MUTABLE (bNodeTreePath *, path, &snode->treepath) { | LISTBASE_FOREACH_MUTABLE (bNodeTreePath *, path, &snode->treepath) { | ||||
| MEM_freeN(path); | MEM_freeN(path); | ||||
| } | } | ||||
| MEM_SAFE_FREE(snode->runtime); | if (snode->runtime) { | ||||
| snode->runtime->linkdrag.reset(); | |||||
| MEM_freeN(snode->runtime); | |||||
| } | |||||
| } | } | ||||
| /* spacetype; init callback */ | /* spacetype; init callback */ | ||||
| static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *area) | static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *area) | ||||
| { | { | ||||
| SpaceNode *snode = (SpaceNode *)area->spacedata.first; | SpaceNode *snode = (SpaceNode *)area->spacedata.first; | ||||
| if (snode->runtime == nullptr) { | if (snode->runtime == nullptr) { | ||||
| ▲ Show 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | |||||
| static SpaceLink *node_duplicate(SpaceLink *sl) | static SpaceLink *node_duplicate(SpaceLink *sl) | ||||
| { | { | ||||
| SpaceNode *snode = (SpaceNode *)sl; | SpaceNode *snode = (SpaceNode *)sl; | ||||
| SpaceNode *snoden = (SpaceNode *)MEM_dupallocN(snode); | SpaceNode *snoden = (SpaceNode *)MEM_dupallocN(snode); | ||||
| BLI_duplicatelist(&snoden->treepath, &snode->treepath); | BLI_duplicatelist(&snoden->treepath, &snode->treepath); | ||||
| if (snode->runtime != nullptr) { | snoden->runtime = nullptr; | ||||
| snoden->runtime = (SpaceNode_Runtime *)MEM_dupallocN(snode->runtime); | |||||
| BLI_listbase_clear(&snoden->runtime->linkdrag); | |||||
| } | |||||
| /* NOTE: no need to set node tree user counts, | /* NOTE: no need to set node tree user counts, | ||||
| * the editor only keeps at least 1 (id_us_ensure_real), | * the editor only keeps at least 1 (id_us_ensure_real), | ||||
| * which is already done by the original SpaceNode. | * which is already done by the original SpaceNode. | ||||
| */ | */ | ||||
| return (SpaceLink *)snoden; | return (SpaceLink *)snoden; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | static void node_group_drop_copy(wmDrag *drag, wmDropBox *drop) | ||||
| RNA_string_set(drop->ptr, "name", id->name + 2); | RNA_string_set(drop->ptr, "name", id->name + 2); | ||||
| } | } | ||||
| static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop) | static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop) | ||||
| { | { | ||||
| ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0); | ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0); | ||||
| RNA_string_set(drop->ptr, "name", id->name + 2); | RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid); | ||||
| } | } | ||||
| static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop) | static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop) | ||||
| { | { | ||||
| ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0); | ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0); | ||||
| if (id) { | if (id) { | ||||
| RNA_string_set(drop->ptr, "name", id->name + 2); | RNA_string_set(drop->ptr, "name", id->name + 2); | ||||
| ▲ Show 20 Lines • Show All 383 Lines • Show Last 20 Lines | |||||