Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_data_pointcloud.py
| Show All 12 Lines | class DataButtonsPanel: | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| engine = context.scene.render.engine | engine = context.scene.render.engine | ||||
| return hasattr(context, "pointcloud") and context.pointcloud and (engine in cls.COMPAT_ENGINES) | return hasattr(context, "pointcloud") and context.pointcloud and (engine in cls.COMPAT_ENGINES) | ||||
| class DATA_PT_context_pointcloud(DataButtonsPanel, Panel): | class DATA_PT_context_pointcloud(DataButtonsPanel, Panel): | ||||
| bl_label = "" | bl_label = "" | ||||
| bl_options = {'HIDE_HEADER'} | bl_options = {'HIDE_HEADER'} | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ob = context.object | ob = context.object | ||||
| pointcloud = context.pointcloud | pointcloud = context.pointcloud | ||||
| space = context.space_data | space = context.space_data | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index): | ||||
| sub = split.row() | sub = split.row() | ||||
| sub.alignment = 'RIGHT' | sub.alignment = 'RIGHT' | ||||
| sub.active = False | sub.active = False | ||||
| sub.label(text=data_type.name) | sub.label(text=data_type.name) | ||||
| class DATA_PT_pointcloud_attributes(DataButtonsPanel, Panel): | class DATA_PT_pointcloud_attributes(DataButtonsPanel, Panel): | ||||
| bl_label = "Attributes" | bl_label = "Attributes" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| def draw(self, context): | def draw(self, context): | ||||
| pointcloud = context.pointcloud | pointcloud = context.pointcloud | ||||
| layout = self.layout | layout = self.layout | ||||
| row = layout.row() | row = layout.row() | ||||
| col = row.column() | col = row.column() | ||||
| col.template_list( | col.template_list( | ||||
| "POINTCLOUD_UL_attributes", | "POINTCLOUD_UL_attributes", | ||||
| "attributes", | "attributes", | ||||
| pointcloud, | pointcloud, | ||||
| "attributes", | "attributes", | ||||
| pointcloud.attributes, | pointcloud.attributes, | ||||
| "active_index", | "active_index", | ||||
| rows=3, | rows=3, | ||||
| ) | ) | ||||
| col = row.column(align=True) | col = row.column(align=True) | ||||
| col.menu("POINTCLOUD_MT_add_attribute", icon='ADD', text="") | col.menu("POINTCLOUD_MT_add_attribute", icon='ADD', text="") | ||||
| col.operator("geometry.attribute_remove", icon='REMOVE', text="") | col.operator("geometry.attribute_remove", icon='REMOVE', text="") | ||||
| class DATA_PT_custom_props_pointcloud(DataButtonsPanel, PropertyPanel, Panel): | class DATA_PT_custom_props_pointcloud(DataButtonsPanel, PropertyPanel, Panel): | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| _context_path = "object.data" | _context_path = "object.data" | ||||
| _property_type = bpy.types.PointCloud if hasattr(bpy.types, "PointCloud") else None | _property_type = bpy.types.PointCloud if hasattr(bpy.types, "PointCloud") else None | ||||
| classes = ( | classes = ( | ||||
| DATA_PT_context_pointcloud, | DATA_PT_context_pointcloud, | ||||
| DATA_PT_pointcloud_attributes, | DATA_PT_pointcloud_attributes, | ||||
| DATA_PT_custom_props_pointcloud, | DATA_PT_custom_props_pointcloud, | ||||
| POINTCLOUD_MT_add_attribute, | POINTCLOUD_MT_add_attribute, | ||||
| POINTCLOUD_UL_attributes, | POINTCLOUD_UL_attributes, | ||||
| ) | ) | ||||
| if __name__ == "__main__": # only for live edit. | if __name__ == "__main__": # only for live edit. | ||||
| from bpy.utils import register_class | from bpy.utils import register_class | ||||
| for cls in classes: | for cls in classes: | ||||
| register_class(cls) | register_class(cls) | ||||