Cycles: add "Textures" panel in particle properties, to make it possble to add

textures when Cycles is selected as render engine.
This commit is contained in:
Brecht Van Lommel
2012-12-16 12:55:52 +00:00
parent 677f519ca5
commit a0855a95db
2 changed files with 43 additions and 1 deletions

View File

@@ -915,6 +915,37 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
layout.template_color_ramp(mapping, "color_ramp", expand=True)
class CyclesParticle_PT_textures(CyclesButtonsPanel, Panel):
bl_label = "Textures"
bl_context = "particle"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
psys = context.particle_system
return psys and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
row = layout.row()
row.template_list(part, "texture_slots", part, "active_texture_index", rows=2)
col = row.column(align=True)
col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
if not part.active_texture:
layout.template_ID(part, "active_texture", new="texture.new")
else:
slot = part.texture_slots[part.active_texture_index]
layout.template_ID(slot, "texture", new="texture.new")
class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
bl_label = "Simplify"
bl_context = "scene"
@@ -1027,6 +1058,7 @@ def get_panels():
bpy.types.TEXTURE_PT_pointdensity_turbulence,
bpy.types.TEXTURE_PT_mapping,
bpy.types.TEXTURE_PT_influence,
bpy.types.TEXTURE_PT_colors,
bpy.types.PARTICLE_PT_context_particles,
bpy.types.PARTICLE_PT_emission,
bpy.types.PARTICLE_PT_hair_dynamics,

View File

@@ -358,7 +358,17 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
}
/* create button */
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name);
if (user->prop) {
PointerRNA texptr = RNA_property_pointer_get(&user->ptr, user->prop);
Tex *tex = texptr.data;
if (tex)
BLI_snprintf(name, UI_MAX_NAME_STR, " %s - %s", user->name, tex->id.name+2);
else
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name);
}
else
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name);
but = uiDefIconTextBut(block, BUT, 0, user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, "");