8 #ifndef MI_NEURAYLIB_MDL_ARGUMENT_EDITOR_H
9 #define MI_NEURAYLIB_MDL_ARGUMENT_EDITOR_H
30 class Mdl_argument_editor
63 neuraylib::ITransaction* transaction,
const char* name, neuraylib::IFactory* factory);
252 const char* argument_name,
Size array_index,
const char* attachment_name);
310 void promote_to_edit_if_needed();
312 base::Handle<neuraylib::ITransaction> m_transaction;
313 base::Handle<neuraylib::IFactory> m_factory;
314 base::Handle<const IScene_element> m_access;
315 base::Handle<const IScene_element> m_old_access;
316 base::Handle<IScene_element> m_edit;
318 MISTD::string m_name;
333 m_type = m_access.is_valid_interface()
334 ? m_access->get_element_type() :
static_cast<Element_type>( 0);
339 return m_access.is_valid_interface()
355 return mi->get_name();
361 return fc->get_name();
373 return mi->get_material_definition();
379 return fc->get_function_definition();
391 return mi->get_parameter_count();
397 return fc->get_parameter_count();
409 return mi->get_parameter_name( index);
415 return fc->get_parameter_name( index);
427 return mi->get_parameter_type( parameter_name);
433 return fc->get_parameter_type( parameter_name);
445 return mi->get_argument_type( argument_name);
451 return fc->get_argument_type( argument_name);
463 return mi->is_parameter_type_uniform( parameter_name);
469 return fc->is_parameter_type_uniform( parameter_name);
485 return fc->get_return_type();
501 return fc->is_return_type_varying();
515 if( !argument.is_valid_interface())
519 return result == 0 ? 0 : -3;
526 if( !argument.is_valid_interface())
530 return result == 0 ? 0 : -3;
544 if( !argument.is_valid_interface())
554 return result == 0 ? 0 : -3;
561 if( !argument.is_valid_interface())
571 return result == 0 ? 0 : -3;
580 promote_to_edit_if_needed();
586 if( !argument.is_valid_interface())
592 return mi->set_argument( argument_name, clone.
get());
598 if( !argument.is_valid_interface())
604 return fc->set_argument( argument_name, clone.
get());
613 promote_to_edit_if_needed();
619 if( !argument.is_valid_interface())
631 return mi->set_argument( argument_name, clone.
get());
637 if( !argument.is_valid_interface())
649 return fc->set_argument( argument_name, clone.
get());
662 if( !argument.is_valid_interface())
664 return argument->get_reference_name() != 0;
671 if( !argument.is_valid_interface())
673 return argument->get_reference_name() != 0;
686 if( !argument.is_valid_interface())
694 return element->get_reference_name() != 0;
701 if( !argument.is_valid_interface())
709 return element->get_reference_name() != 0;
722 if( !argument.is_valid_interface())
724 return argument->get_reference_name();
731 if( !argument.is_valid_interface())
733 return argument->get_reference_name();
740 const char* argument_name,
Size array_index)
const
747 if( !argument.is_valid_interface())
755 return element->get_reference_name();
762 if( !argument.is_valid_interface())
770 return element->get_reference_name();
777 const char* argument_name,
const char* attachment_name)
779 promote_to_edit_if_needed();
785 if( !argument.is_valid_interface())
788 if( clone->set_reference( attachment_name) != 0)
790 return mi->set_argument( argument_name, clone.
get());
796 if( !argument.is_valid_interface())
799 if( clone->set_reference( attachment_name) != 0)
801 return fc->set_argument( argument_name, clone.
get());
808 const char* argument_name,
Size array_index,
const char* attachment_name)
810 promote_to_edit_if_needed();
816 if( !argument.is_valid_interface())
825 if( element->set_reference( attachment_name) != 0)
827 return mi->set_argument( argument_name, clone.
get());
833 if( !argument.is_valid_interface())
842 if( element->set_reference( attachment_name) != 0)
844 return fc->set_argument( argument_name, clone.
get());
867 if( !argument.is_valid_interface())
872 size = array->get_length();
880 if( !argument.is_valid_interface())
885 size = array->get_length();
894 promote_to_edit_if_needed();
900 if( !argument.is_valid_interface())
906 dynamic_array->set_length( size);
907 mi->set_argument( argument_name, clone.
get());
914 if( !argument.is_valid_interface())
920 dynamic_array->set_length( size);
921 fc->set_argument( argument_name, clone.
get());
928 inline void Mdl_argument_editor::promote_to_edit_if_needed()
930 if( m_edit.is_valid_interface())
934 m_old_access = m_access;
940 #endif // MI_NEURAYLIB_MDL_ARGUMENT_EDITOR_H