@@ -701,30 +701,34 @@ PyObject *py_unreal_engine_add_component_to_blueprint(PyObject * self, PyObject
701701 }
702702
703703 USCS_Node *parentNode = nullptr ;
704- if (parentName)
705- {
706- FString strParentName = UTF8_TO_TCHAR (parentName);
707- if (strParentName. IsEmpty () )
704+
705+ if (component_class-> IsChildOf <USceneComponent>()) {
706+
707+ if (parentName )
708708 {
709- parentNode = bp->SimpleConstructionScript ->GetDefaultSceneRootNode ();
709+ FString strParentName = UTF8_TO_TCHAR (parentName);
710+ if (strParentName.IsEmpty ())
711+ {
712+ parentNode = bp->SimpleConstructionScript ->GetDefaultSceneRootNode ();
713+ }
714+ else
715+ {
716+ parentNode = bp->SimpleConstructionScript ->FindSCSNode (UTF8_TO_TCHAR (parentName));
717+ }
710718 }
711719 else
712720 {
713- parentNode = bp->SimpleConstructionScript ->FindSCSNode ( UTF8_TO_TCHAR (parentName) );
721+ parentNode = bp->SimpleConstructionScript ->GetDefaultSceneRootNode ( );
714722 }
715723 }
716- else
717- {
718- parentNode = bp->SimpleConstructionScript ->GetDefaultSceneRootNode ();
719- }
720-
721724
722725 if (parentNode) {
723726 parentNode->AddChildNode (node);
724727 }
725728 else {
726729 bp->SimpleConstructionScript ->AddNode (node);
727730 }
731+
728732 FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified (bp);
729733
730734 ue_PyUObject *ret = ue_get_python_wrapper (node->ComponentTemplate );
@@ -769,6 +773,35 @@ PyObject *py_unreal_engine_blueprint_add_member_variable(PyObject * self, PyObje
769773 return Py_False;
770774}
771775
776+ PyObject *py_unreal_engine_blueprint_set_variable_visibility (PyObject * self, PyObject * args) {
777+
778+ PyObject *py_blueprint;
779+ char *name;
780+ PyObject *visibility;
781+ if (!PyArg_ParseTuple (args, " OsO:blueprint_set_variable_visibility" , &py_blueprint, &name, &visibility)) {
782+ return NULL ;
783+ }
784+
785+ if (!ue_is_pyuobject (py_blueprint)) {
786+ return PyErr_Format (PyExc_Exception, " argument is not a UObject" );
787+ }
788+
789+ ue_PyUObject *py_obj = (ue_PyUObject *)py_blueprint;
790+ if (!py_obj->ue_object ->IsA <UBlueprint>())
791+ return PyErr_Format (PyExc_Exception, " uobject is not a UBlueprint" );
792+ UBlueprint *bp = (UBlueprint *)py_obj->ue_object ;
793+
794+ bool visible = false ;
795+ if (PyObject_IsTrue (visibility)) {
796+ visible = true ;
797+ }
798+
799+ FBlueprintEditorUtils::SetBlueprintOnlyEditableFlag (bp, FName (UTF8_TO_TCHAR (name)), visible);
800+
801+ Py_INCREF (Py_None);
802+ return Py_None;
803+ }
804+
772805PyObject *py_unreal_engine_blueprint_add_new_timeline (PyObject * self, PyObject * args) {
773806
774807 PyObject *py_blueprint;
@@ -963,7 +996,7 @@ PyObject *py_unreal_engine_move_selected_actors_to_level(PyObject *self, PyObjec
963996 ULevel *level = (ULevel *)py_obj_level->ue_object ;
964997
965998 GEditor->MoveSelectedActorsToLevel (level);
966-
999+
9671000 Py_INCREF (Py_None);
9681001 return Py_None;
9691002}
0 commit comments