Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/render/render_shading.c
| Show First 20 Lines • Show All 402 Lines • ▼ Show 20 Lines | else { | ||||
| if (BKE_scene_use_new_shading_nodes(scene)) { | if (BKE_scene_use_new_shading_nodes(scene)) { | ||||
| ED_node_shader_default(C, &ma->id); | ED_node_shader_default(C, &ma->id); | ||||
| ma->use_nodes = true; | ma->use_nodes = true; | ||||
| } | } | ||||
| } | } | ||||
| /* hook into UI */ | /* hook into UI */ | ||||
| uiIDContextProperty(C, &ptr, &prop); | UI_context_active_but_prop_get_templateID(C, &ptr, &prop); | ||||
| if (prop) { | if (prop) { | ||||
| /* when creating new ID blocks, use is already 1, but RNA | /* when creating new ID blocks, use is already 1, but RNA | ||||
| * pointer se also increases user, so this compensates it */ | * pointer se also increases user, so this compensates it */ | ||||
| ma->id.us--; | ma->id.us--; | ||||
| RNA_id_pointer_create(&ma->id, &idptr); | RNA_id_pointer_create(&ma->id, &idptr); | ||||
| RNA_property_pointer_set(&ptr, prop, idptr); | RNA_property_pointer_set(&ptr, prop, idptr); | ||||
| Show All 32 Lines | static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| if (tex) { | if (tex) { | ||||
| tex = BKE_texture_copy(tex); | tex = BKE_texture_copy(tex); | ||||
| } | } | ||||
| else { | else { | ||||
| tex = add_texture(bmain, DATA_("Texture")); | tex = add_texture(bmain, DATA_("Texture")); | ||||
| } | } | ||||
| /* hook into UI */ | /* hook into UI */ | ||||
| uiIDContextProperty(C, &ptr, &prop); | UI_context_active_but_prop_get_templateID(C, &ptr, &prop); | ||||
| if (prop) { | if (prop) { | ||||
| /* when creating new ID blocks, use is already 1, but RNA | /* when creating new ID blocks, use is already 1, but RNA | ||||
| * pointer se also increases user, so this compensates it */ | * pointer se also increases user, so this compensates it */ | ||||
| tex->id.us--; | tex->id.us--; | ||||
| if (ptr.id.data && GS(((ID *)ptr.id.data)->name) == ID_MA && | if (ptr.id.data && GS(((ID *)ptr.id.data)->name) == ID_MA && | ||||
| RNA_property_pointer_get(&ptr, prop).id.data == NULL) | RNA_property_pointer_get(&ptr, prop).id.data == NULL) | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | else { | ||||
| if (BKE_scene_use_new_shading_nodes(scene)) { | if (BKE_scene_use_new_shading_nodes(scene)) { | ||||
| ED_node_shader_default(C, &wo->id); | ED_node_shader_default(C, &wo->id); | ||||
| wo->use_nodes = true; | wo->use_nodes = true; | ||||
| } | } | ||||
| } | } | ||||
| /* hook into UI */ | /* hook into UI */ | ||||
| uiIDContextProperty(C, &ptr, &prop); | UI_context_active_but_prop_get_templateID(C, &ptr, &prop); | ||||
| if (prop) { | if (prop) { | ||||
| /* when creating new ID blocks, use is already 1, but RNA | /* when creating new ID blocks, use is already 1, but RNA | ||||
| * pointer se also increases user, so this compensates it */ | * pointer se also increases user, so this compensates it */ | ||||
| wo->id.us--; | wo->id.us--; | ||||
| RNA_id_pointer_create(&wo->id, &idptr); | RNA_id_pointer_create(&wo->id, &idptr); | ||||
| RNA_property_pointer_set(&ptr, prop, idptr); | RNA_property_pointer_set(&ptr, prop, idptr); | ||||
| ▲ Show 20 Lines • Show All 1,253 Lines • Show Last 20 Lines | |||||