8 #ifndef MI_NEURAYLIB_MDL_ARGUMENT_EDITOR_H
9 #define MI_NEURAYLIB_MDL_ARGUMENT_EDITOR_H
33 class Mdl_argument_editor
66 ITransaction* transaction,
const char* name, IFactory* factory);
428 Uint32 argument_index,
Size array_index,
const char* attachment_name);
445 const char* argument_name,
Size array_index,
const char* attachment_name);
565 void promote_to_edit_if_needed();
567 base::Handle<neuraylib::ITransaction> m_transaction;
568 base::Handle<neuraylib::IFactory> m_factory;
569 base::Handle<const IScene_element> m_access;
570 base::Handle<const IScene_element> m_old_access;
571 base::Handle<IScene_element> m_edit;
588 m_type = m_access.is_valid_interface()
589 ? m_access->get_element_type() :
static_cast<Element_type>( 0);
594 return m_access.is_valid_interface()
610 return mi->get_name();
616 return fc->get_name();
628 return mi->get_material_definition();
634 return fc->get_function_definition();
646 return mi->get_parameter_count();
652 return fc->get_parameter_count();
664 return mi->get_parameter_name( index);
670 return fc->get_parameter_name( index);
682 return mi->get_parameter_index( name);
688 return fc->get_parameter_index( name);
700 return mi->get_parameter_type( index);
706 return fc->get_parameter_type( index);
718 return mi->get_parameter_type( name);
724 return fc->get_parameter_type( name);
736 return mi->get_argument_type( index);
742 return fc->get_argument_type( index);
754 return mi->get_argument_type( name);
760 return fc->get_argument_type( name);
772 return mi->is_parameter_type_uniform( index);
778 return fc->is_parameter_type_uniform( index);
790 return mi->is_parameter_type_uniform( name);
796 return fc->is_parameter_type_uniform( name);
812 return fc->get_return_type();
828 return fc->is_return_type_varying();
865 if( !argument.is_valid_interface())
869 return result == 0 ? 0 : -3;
876 if( !argument.is_valid_interface())
880 return result == 0 ? 0 : -3;
894 if( !argument.is_valid_interface())
898 return result == 0 ? 0 : -3;
905 if( !argument.is_valid_interface())
909 return result == 0 ? 0 : -3;
923 if( !argument.is_valid_interface())
933 return result == 0 ? 0 : -3;
940 if( !argument.is_valid_interface())
950 return result == 0 ? 0 : -3;
964 if( !argument.is_valid_interface())
974 return result == 0 ? 0 : -3;
981 if( !argument.is_valid_interface())
991 return result == 0 ? 0 : -3;
1000 promote_to_edit_if_needed();
1006 if( !argument.is_valid_interface())
1012 return mi->set_argument( argument_index, clone.
get());
1018 if( !argument.is_valid_interface())
1024 return fc->set_argument( argument_index, clone.
get());
1033 promote_to_edit_if_needed();
1039 if( !argument.is_valid_interface())
1045 return mi->set_argument( argument_name, clone.
get());
1051 if( !argument.is_valid_interface())
1057 return fc->set_argument( argument_name, clone.
get());
1066 promote_to_edit_if_needed();
1072 if( !argument.is_valid_interface())
1084 return mi->set_argument( argument_index, clone.
get());
1090 if( !argument.is_valid_interface())
1102 return fc->set_argument( argument_index, clone.
get());
1111 promote_to_edit_if_needed();
1117 if( !argument.is_valid_interface())
1129 return mi->set_argument( argument_name, clone.
get());
1135 if( !argument.is_valid_interface())
1147 return fc->set_argument( argument_name, clone.
get());
1160 if( !argument.is_valid_interface())
1162 return argument->get_reference_name() != 0;
1169 if( !argument.is_valid_interface())
1171 return argument->get_reference_name() != 0;
1184 if( !argument.is_valid_interface())
1186 return argument->get_reference_name() != 0;
1193 if( !argument.is_valid_interface())
1195 return argument->get_reference_name() != 0;
1208 if( !argument.is_valid_interface())
1216 return element->get_reference_name() != 0;
1223 if( !argument.is_valid_interface())
1231 return element->get_reference_name() != 0;
1244 if( !argument.is_valid_interface())
1252 return element->get_reference_name() != 0;
1259 if( !argument.is_valid_interface())
1267 return element->get_reference_name() != 0;
1280 if( !argument.is_valid_interface())
1282 return argument->get_reference_name();
1289 if( !argument.is_valid_interface())
1291 return argument->get_reference_name();
1304 if( !argument.is_valid_interface())
1306 return argument->get_reference_name();
1313 if( !argument.is_valid_interface())
1315 return argument->get_reference_name();
1322 Uint32 argument_index,
Size array_index)
const
1329 if( !argument.is_valid_interface())
1337 return element->get_reference_name();
1344 if( !argument.is_valid_interface())
1352 return element->get_reference_name();
1359 const char* argument_name,
Size array_index)
const
1366 if( !argument.is_valid_interface())
1374 return element->get_reference_name();
1381 if( !argument.is_valid_interface())
1389 return element->get_reference_name();
1396 Uint32 argument_index,
const char* attachment_name)
1398 promote_to_edit_if_needed();
1404 if( !argument.is_valid_interface())
1407 if( clone->set_reference( attachment_name) != 0)
1409 return mi->set_argument( argument_index, clone.
get());
1415 if( !argument.is_valid_interface())
1418 if( clone->set_reference( attachment_name) != 0)
1420 return fc->set_argument( argument_index, clone.
get());
1427 const char* argument_name,
const char* attachment_name)
1429 promote_to_edit_if_needed();
1435 if( !argument.is_valid_interface())
1438 if( clone->set_reference( attachment_name) != 0)
1440 return mi->set_argument( argument_name, clone.
get());
1446 if( !argument.is_valid_interface())
1449 if( clone->set_reference( attachment_name) != 0)
1451 return fc->set_argument( argument_name, clone.
get());
1458 Uint32 argument_index,
Size array_index,
const char* attachment_index)
1460 promote_to_edit_if_needed();
1466 if( !argument.is_valid_interface())
1475 if( element->set_reference( attachment_index) != 0)
1477 return mi->set_argument( argument_index, clone.
get());
1483 if( !argument.is_valid_interface())
1492 if( element->set_reference( attachment_index) != 0)
1494 return fc->set_argument( argument_index, clone.
get());
1501 const char* argument_name,
Size array_index,
const char* attachment_name)
1503 promote_to_edit_if_needed();
1509 if( !argument.is_valid_interface())
1518 if( element->set_reference( attachment_name) != 0)
1520 return mi->set_argument( argument_name, clone.
get());
1526 if( !argument.is_valid_interface())
1535 if( element->set_reference( attachment_name) != 0)
1537 return fc->set_argument( argument_name, clone.
get());
1570 if( !argument.is_valid_interface())
1575 size = array->get_length();
1583 if( !argument.is_valid_interface())
1588 size = array->get_length();
1602 if( !argument.is_valid_interface())
1607 size = array->get_length();
1615 if( !argument.is_valid_interface())
1620 size = array->get_length();
1629 promote_to_edit_if_needed();
1635 if( !argument.is_valid_interface())
1641 dynamic_array->set_length( size);
1642 mi->set_argument( argument_index, clone.
get());
1649 if( !argument.is_valid_interface())
1655 dynamic_array->set_length( size);
1656 fc->set_argument( argument_index, clone.
get());
1665 promote_to_edit_if_needed();
1671 if( !argument.is_valid_interface())
1677 dynamic_array->set_length( size);
1678 mi->set_argument( argument_name, clone.
get());
1685 if( !argument.is_valid_interface())
1691 dynamic_array->set_length( size);
1692 fc->set_argument( argument_name, clone.
get());
1699 inline void Mdl_argument_editor::promote_to_edit_if_needed()
1701 if( m_edit.is_valid_interface())
1705 m_old_access = m_access;
1711 #ifdef MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
1715 using neuraylib::IMdl_function_call;
1716 using neuraylib::IMdl_material_instance;
1717 using neuraylib::IScene_element;
1718 using neuraylib::Mdl_argument_editor;
1719 #endif // MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
1723 #endif // MI_NEURAYLIB_MDL_ARGUMENT_EDITOR_H