|
@@ -160,21 +160,16 @@ class ContainerManager(QObject):
|
|
|
|
|
|
return container.getProperty(setting_key, property_name)
|
|
|
|
|
|
- ## Set the name of the specified container.
|
|
|
- @pyqtSlot(str, str, result = bool)
|
|
|
- def setContainerName(self, container_id, new_name):
|
|
|
- if self._container_registry.isReadOnly(container_id):
|
|
|
- Logger.log("w", "Cannot set name of read-only container %s.", container_id)
|
|
|
- return False
|
|
|
-
|
|
|
- containers = self._container_registry.findContainers(id = container_id) #We need to get the full container, not just metadata, since we need to know whether it's read-only.
|
|
|
- if not containers:
|
|
|
- Logger.log("w", "Could not set name of container %s because it was not found.", container_id)
|
|
|
- return False
|
|
|
-
|
|
|
- containers[0].setName(new_name)
|
|
|
+ ## Set the name of the specified material.
|
|
|
+ @pyqtSlot("QVariant", str)
|
|
|
+ def setMaterialName(self, material_node, new_name):
|
|
|
+ root_material_id = material_node.metadata["base_file"]
|
|
|
+ if self._container_registry.isReadOnly(root_material_id):
|
|
|
+ Logger.log("w", "Cannot set name of read-only container %s.", root_material_id)
|
|
|
+ return
|
|
|
|
|
|
- return True
|
|
|
+ material_group = self._material_manager.getMaterialGroup(root_material_id)
|
|
|
+ material_group.root_material_node.getContainer().setName(new_name)
|
|
|
|
|
|
## Find instance containers matching certain criteria.
|
|
|
#
|